gapotchenko / gapotchenko.fx Goto Github PK
View Code? Open in Web Editor NEW.NET polyfill to the future. A versatile RAD framework for .NET platform.
License: MIT License
.NET polyfill to the future. A versatile RAD framework for .NET platform.
License: MIT License
This is correct for getting the environment variables of the process when it was started, but not for getting the actual current state.
gdb is able to do this: start bash in one terminal, echo $$
to get its PID, then sudo gdb --pid=<PID>
to launch gdb. Then just do p environ[0]
and it will give you the first environment variable.
It may be possible to use libc's ptrace to coerce the environment variables from a running process, but there is a security restriction in that ptrace will fail on any other process unless you run it as root, or you started it with fork(). I don't know if Process.Start() uses fork() internally.
There is a fairly detailed discussion about it here:
https://unix.stackexchange.com/questions/29128/how-to-read-environment-variables-of-a-process
Don't feel compelled by the notion of shelling to gdb if it's available: sibling processes cannot access one another.
I am getting the following exception
Message: System.IO.EndOfStreamException : Attempted to read past the end of the stream. Stack Trace: ProcessBinaryReader.ReadCString() ProcessEnvironment._ReadEnv(ProcessBinaryReader br) ProcessEnvironment._ReadVariablesCore(IntPtr hProcess) ProcessEnvironment.ReadVariables(Process process) ImplementationAdapter.ReadProcessEnvironmentVariables(Process process) ProcessExtensions.ReadEnvironmentVariables(Process process)
From my code:
var oldProcesses = Process.GetProcesses() .Where(x => x.ProcessName.Contains("dotnet")) && x.ReadEnvironmentVariables().ContainsKey("...")).ToList();
I am using version 2020.1.15 of the nuget package. I only see the error occasionally, I have tried to find something that distinguishes the errored process from other processes and have to yet find anything.
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.