Fix linux CLI sudo argument parsing

Fixes #17713
This commit is contained in:
Daniel Imms
2017-01-25 12:03:55 -08:00
parent 53ef9ca240
commit 289dbf77e3

View File

@@ -5,12 +5,11 @@
# If root, ensure that --user-data-dir is specified # If root, ensure that --user-data-dir is specified
if [ "$(id -u)" = "0" ]; then if [ "$(id -u)" = "0" ]; then
while test $# -gt 0 for i in $@
do do
if [[ $1 == --user-data-dir=* ]]; then if [[ $i == --user-data-dir=* ]]; then
DATA_DIR_SET=1 DATA_DIR_SET=1
fi fi
shift
done done
if [ -z $DATA_DIR_SET ]; then 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 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