-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
Expose terminal process ID through API #11919
Comments
Extension authors want to get at the process ID of the shell so they can track what they run, at least on a low level. The problem is that due to a bug in electron (electron/electron#38) there is another process in between the renderer thread and the shell which launches the shell, meaning it's an async operation to grab the PID after the terminal is created. Therefore, in order to maintain backwards compatibility I think this will need to be exposed as a promise: // Returns the shell PID
getProcessID(): Thenable<number>; Alternatively we could expose the in-between process synchronously, it would probably mean more work and confusion for extension authors though: // Returns the PID of the process that launches the shell
getProcessID(): number; @jrieken does the |
You could just expose the tenable property? Like interface Terminal {
// ...
pid: Thenable<number>
} |
If that's preferable 👍 |
Yeah - I think that more JavaScript'ish |
I ended up expanding to interface Terminal {
processId: Thenable<number>
} FYI @daviwil |
Awesome, thanks man! |
@Tyriar So it is not there yet? Updated to latest insiders and terminal._id stopped to work. |
@whitecolor insiders just exposed the above API |
@Tyriar Ok There seem to be a problemwith And aslo why |
@whitecolor Before: The child processes of
|
ok, but it seem that internal processes (running inside the console) is spawned not by this processesId, but by teminalProcess. Btw |
@whitecolor It doesn't seem right that the processes would be children of terminalProcess.js which only spawns the shell. I looked into this in the past and it worked fine. There's only a single spawn in terminalProcess https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/parts/terminal/electron-browser/terminalProcess.js#L30 The processes launched by the terminal are launched by the shell that they're run in. |
@Tyriar ok, thanks, I will look into it more carefully |
@Tyriar I check all process running in windows ( |
Can you launch vscode, the terminal and then some program in the terminal and see what the tree looks like? I expect it to be:
|
What tree? (where should I look it)? I just get pid, and check it either using wmic or process exlorer, there is not such pid at all. Should it be there? |
@whitecolor depends on your platform, on Linux I can run
|
@Tyriar can you confirm my issue with process id? |
@whitecolor it's being tested today by 2 team members that will verify the process ID. |
@Tyriar Was it a bug and fixed? |
@whitecolor no bug has been reported so far, not sure how many people are using it though. |
So it was tested and you can not confirm it? |
Yes nothing was reported during the test phase and it's currently in stable. |
@Tyriar Well I'm not sure how I should demonstate that something wrong here. For me |
Created #14286 to track your issue |
Part of #11422
The text was updated successfully, but these errors were encountered: