mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-23 11:49:38 +00:00
allow to run CLI as root when running --write-elevated-helper
This commit is contained in:
@@ -3,15 +3,15 @@
|
||||
# Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
# Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
|
||||
# If root, ensure that --user-data-dir is specified
|
||||
# If root, ensure that --user-data-dir or --write-elevated-helper is specified
|
||||
if [ "$(id -u)" = "0" ]; then
|
||||
for i in $@
|
||||
do
|
||||
if [[ $i == --user-data-dir=* ]]; then
|
||||
DATA_DIR_SET=1
|
||||
if [[ $i == --user-data-dir=* || $i == --write-elevated-helper ]]; then
|
||||
CAN_LAUNCH_AS_ROOT=1
|
||||
fi
|
||||
done
|
||||
if [ -z $DATA_DIR_SET ]; then
|
||||
if [ -z $CAN_LAUNCH_AS_ROOT ]; then
|
||||
echo "You are trying to start vscode as a super user which is not recommended. If you really want to, you must specify an alternate user data directory using the --user-data-dir argument." 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user