-
Notifications
You must be signed in to change notification settings - Fork 28k
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
Strange CLI behavior: CLI does not seem to write to either stdout (FD 1) or stderr (FD 2), making output impossible to redirect. #8585
Comments
I have the completely same issue. |
Seems fine on Linux, are these commands supposed to work on windows? It also seems to direct to stdout fine on 1.2.1.
|
Perhaps this is related to code.sh or code.cmd here? PRs welcome if that is the case. |
This seems to be a problem with electron rather than VSCode specifically. See e.g. electron/electron#683 and electron/electron#4552 The workaround I'm using is to set the process.env.ELECTRON_NO_ATTACH_CONSOLE = true;
const { execSync } = require('child_process');
const installedExtensions = execSync('code --list-extensions')
.toString()
.split('\n')
.filter(Boolean);
// outputs an array
console.log(installedExtensions); |
It seems that the current stable version, 1.7.2 works correctly. I think we can close the issue now.
|
I guess it was fixed upstream at some point then, thanks for letting me know @espresso3389. |
Verified on Windows 10. |
Strange CLI behavior: the VS Code CLI does not seem to write to either stdout (FD 1) or stderr (FD 2), making output impossible to pipe to e.g.
grep
to search for a particular flag, and making it impossible to hide output in scripting (not that I can think of a good reason you would want to script thecode
CLI).Steps to Reproduce:
code-insiders -h > NUL
from cmdcode-insiders -h 1> NUL
from cmdcode-insiders -h 2> NUL
from cmdThe text was updated successfully, but these errors were encountered: