aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrkirch <brkirch@users.noreply.github.com>2022-12-01 09:04:14 +0000
committerbrkirch <brkirch@users.noreply.github.com>2022-12-01 09:49:49 +0000
commitbef36597cc46671eeb2041b0343bd5e183883eb7 (patch)
tree7ccb2f20d1abe8c63f04545c456ea8f9d45d0d4b
parent79953e9b8b0d04868b719452a5b250c450f757b6 (diff)
downloadstable-diffusion-webui-gfx803-bef36597cc46671eeb2041b0343bd5e183883eb7.tar.gz
stable-diffusion-webui-gfx803-bef36597cc46671eeb2041b0343bd5e183883eb7.tar.bz2
stable-diffusion-webui-gfx803-bef36597cc46671eeb2041b0343bd5e183883eb7.zip
Fix run as root flag
Even though -f enables running webui.sh as root, the -f flag will also be passed to launch.py, causing it to exit with a usage message. This adds a line to launch.py to remove the -f flag if present. In addition to the above, all the letters in the command line arguments after each '-' were being processed for 'f' and "illegal option" was displayed for each letter that didn't match. Instead, this commit silences those errors and stops processing if the first flag doesn't start with '-f'.
-rw-r--r--launch.py1
-rwxr-xr-xwebui.sh3
2 files changed, 3 insertions, 1 deletions
diff --git a/launch.py b/launch.py
index 48314264..1661b569 100644
--- a/launch.py
+++ b/launch.py
@@ -186,6 +186,7 @@ def prepare_enviroment():
parser.add_argument("--ui-settings-file", type=str, help="filename to use for ui settings", default='config.json')
args, _ = parser.parse_known_args(sys.argv)
+ sys.argv, _ = extract_arg(sys.argv, '-f')
sys.argv, skip_torch_cuda_test = extract_arg(sys.argv, '--skip-torch-cuda-test')
sys.argv, reinstall_xformers = extract_arg(sys.argv, '--reinstall-xformers')
sys.argv, update_check = extract_arg(sys.argv, '--update-check')
diff --git a/webui.sh b/webui.sh
index 6d4f0992..5f48741f 100755
--- a/webui.sh
+++ b/webui.sh
@@ -51,10 +51,11 @@ fi
can_run_as_root=0
# read any command line flags to the webui.sh script
-while getopts "f" flag
+while getopts "f" flag > /dev/null 2>&1
do
case ${flag} in
f) can_run_as_root=1;;
+ *) break;;
esac
done