You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Command line arguments not working as expected #15435
bugIssue identified by VS Code Team member as probable buglinuxIssues with VS Code on Linuxverification-neededVerification of issue is requestedverifiedVerification succeeded
As per, issue #6484 (closed), the command line arguments such as -h, should work with the
current version of VS Code. But does not work as expected in normal ubuntu installation.
Binary being used:
/usr/bin/code -> /usr/share/code/bin/code
VSCode Version:
Version 1.7.1
Commit 02611b40b24c9df2726ad8b33f5ef5f67ac30b44
Date 2016-11-03T13:46:46.244Z
Shell 1.3.8
Renderer 52.0.2743.82
Node 6.5.0
After a short digging around, either the main executable at /usr/share/code/bin/code is
ignoring other arguments, including --user-data-dir when ELECTRON_RUN_AS_NODE=1 is
present. Or $VSCODE_PATH/resources/app/out/cli.js is supressing or not using the other args.
When the bash startup script, /usr/share/code/bin/code is used, there is no effect of
arguments including path to open as well as other args like --help. The user-data-dir is
not created when --user-data-dir is passed.
Whereas, when the main executable (/usr/share/code/code) is used, it looks like the
arguments are passed and processed correctly. path to open, --new-window, -r are working
as expected. But i guess the absence of $VSCODE_PATH/resources/app/out/cli.js, is
causing causing the writing back to starting shell fail. Following errors are shown when
using main executable.
bash: cannot set terminal process group (-1): Inappropriate ioctl for device
bash: no job control in this shell
Not a vm. But if there are switches or edits that i can do to enable trace, i can run with trace on and share the output. I also tried apt-get remove --purge code and used the tar.gz version, same problem.
Any chances that there might be a conflict with existing electron installation ?
I think i found the root cause, can you share your startup script, may be we are using
different version that it is working on your end.
The script is shifting and throwing away all args when used as root to check --user-data-dir.
if [ "$(id -u)" = "0" ]; then
while test $# -gt 0
do
if [[ $1 == --user-data-dir=* ]]; then
DATA_DIR_SET=1
fi
shift
done
if [ -z $DATA_DIR_SET ]; then
echo "It is recommended to start vscode as a normal user. To run as root, you must specify an alternate user data directory with the --user-data-dir argument." 1>&2
exit 1
fi
fi
Just submitted a pull request with changes that retains and passes the commandline args.
bugIssue identified by VS Code Team member as probable buglinuxIssues with VS Code on Linuxverification-neededVerification of issue is requestedverifiedVerification succeeded
Activity
aniljava commentedon Nov 14, 2016
Updates:
After a short digging around, either the main executable at
/usr/share/code/bin/codeisignoring other arguments, including --user-data-dir when
ELECTRON_RUN_AS_NODE=1ispresent. Or
$VSCODE_PATH/resources/app/out/cli.jsis supressing or not using the other args.When the bash startup script,
/usr/share/code/bin/codeis used, there is no effect ofarguments including path to open as well as other args like --help. The user-data-dir is
not created when
--user-data-diris passed.Whereas, when the main executable (
/usr/share/code/code) is used, it looks like thearguments are passed and processed correctly. path to open, --new-window, -r are working
as expected. But i guess the absence of
$VSCODE_PATH/resources/app/out/cli.js, iscausing causing the writing back to starting shell fail. Following errors are shown when
using main executable.
joaomoreno commentedon Nov 14, 2016
Strange. I just tried, but failed to reproduce. We'd need to debug the CLI code on your machine. Any chance that it's a VM you could send us?
aniljava commentedon Nov 14, 2016
Not a vm. But if there are switches or edits that i can do to enable trace, i can run with trace on and share the output. I also tried
apt-get remove --purge codeand used the tar.gz version, same problem.Any chances that there might be a conflict with existing electron installation ?
joaomoreno commentedon Nov 14, 2016
Interesting. Could be. Try the insiders version, since it's a completely separate product: http://code.visualstudio.com/insiders
Fix to retain and pass args
aniljava commentedon Nov 14, 2016
I think i found the root cause, can you share your startup script, may be we are using
different version that it is working on your end.
The script is shifting and throwing away all args when used as root to check --user-data-dir.
Just submitted a pull request with changes that retains and passes the commandline args.
joaomoreno commentedon Nov 14, 2016
Great to know. Moving this to Daniel Imms (@Tyriar), he should know the details of that script. 👍
Great work, thanks for the effort! 🍻
Tyriar commentedon Nov 14, 2016
Fixed in #15448
roblourens commentedon Dec 8, 2016
Verified:
sudo code --user-data-dir=./codedir --helpignores--help.sudo code-insiders --user-data-dir=./codedir --helpdoes not ignore it.