Skip to content
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

Close non-std FDs between pty_forkpty and pty_execvpe #657

Open
htfy96 opened this issue Jan 21, 2024 · 0 comments
Open

Close non-std FDs between pty_forkpty and pty_execvpe #657

htfy96 opened this issue Jan 21, 2024 · 0 comments

Comments

@htfy96
Copy link

htfy96 commented Jan 21, 2024

Environment details

  • OS: Linux
  • OS version: Linux 6.7
  • node-pty version: The one bundled in VSCode, and I believe it still exists on master

Issue description

Related to microsoft/vscode#202558 .

Currently node-pty doesn't close unwanted fds before spawning the process in pty_execvpe. This caused the above issue where Node's open fd(s) accidentally leaks into the spawned process. Considering that very few spawned shell process are aware to the non-std fds, I doubt if this would ever be the desired behavior.

To reduce the amount of surprise, I hope it could do something like https://github.com/facebook/folly/blob/main/folly/Subprocess.cpp#L559 to close all unwanted fds before spawning the shell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant