-
Notifications
You must be signed in to change notification settings - Fork 846
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I find out the bash PID from a Windows cmd/powershell prompt? #3174
Comments
Then run: |
There is no easy way to map between the two ID's. Currently this is mostly because we are not exposing it in any way, but beyond that there may not be a 1:1 mapping between the two due to things like clone flags. Additionally the mapping may not be static as we try to play nice with process monitoring tools (AV, et al.) by creating new NT processes in response to exec since that is how it is normally done from Windows. |
@Biswa96 @Brian-Perkins I recently started using Hyper and found a bunch of plugins that have problems with WSL, for instance:
The first two have basically the same issue, they need to read the current shell absolute path from Hyper and there's no proper way to do that. The third one depends on the current foreground process running in the shell (I'm not sure if this could be fixed even if we could read the bash PID). In other words, to fix all these plugins properly, we'd need WSL to expose the current absolute path and running process and somehow map it properly per Windows PID (because Hyper is tabbed and we can have multiple WSL instances running). Given the current state of WSL I couldn't think of any way to get these plugins to work with WSL. Thoughts? |
@rfgamaral Are you running hyper over X, or are you running the Windows version? If the Windows version is compatible with cygwin, you can probably use rprichard's WSLbridge, which pipes the terminal through to a cygwin pty. |
@fpqc I'm using the Windows version. However, I'm not sure the PID mapping between Windows and the running bash instance inside WSL can be done like @Brian-Perkins mentioned. |
It is something that would have to be implemented in the plugin, which is crossing a boundary. Brian mentions Linux PID namespaces and multiple WSL instances, but it is more straightforward to think of hyper in a ssh session. Javascript on Windows has no idea what the PIDs are over on the remote machine. It would be like asking a DEC VT100 firmware programmer in 1978 to tell you the PID or path of the shell on the other end of the RS232 wire. This said, there needs to be some API to expose the mapping. |
Someone opened a UserVoice here. |
This ticket is also related to winsiderss/systeminformer#153 We also need something to map the NT processid to the WSL processid to implement those missing features (this also applies to the same features in Task Manager and Process Explorer). One example is right-clicking a process in Task Manager/Process Explorer/Process Hacker and selecting the Debug menu to launch the debugger (e.g. Are you able to follow this up? |
Ref #6881 |
In mingw I believe its |
Say I have the Windows PID from the bash process when running a WSL instance. Is it possible to get the bash process PID using cmd/powershell?
How can I use the 7100 in this example, to get the 3?
The text was updated successfully, but these errors were encountered: