summaryrefslogtreecommitdiff
path: root/run
diff options
context:
space:
mode:
authorAnders Kaseorg <andersk@mit.edu>2019-08-17 11:25:29 -0700
committerAnders Kaseorg <andersk@mit.edu>2019-08-17 11:39:46 -0700
commit5052f823d74241d099688c3a8ceb0de57541e968 (patch)
tree3cbe02e43bca0ee6eccc1177ef328d0e379f081c /run
parent654cbac77ea07819ed3bcf1ce6410be0211c0f1a (diff)
downloadwebsockify-5052f823d74241d099688c3a8ceb0de57541e968.tar.gz
run: Fix shell scripting bugs
* Use double quotes around `"$@"` to fix invocation with arguments including spaces. * Use double quotes around `"$(dirname "$0")"` to fix invocation inside a directory path including spaces. * Use `set -e` to abort in case `cd` fails. * Use `exec` to avoid forking an unnecessary wrapper process. * Skip an unnecessary `cd` → `pwd` → `cd` dance, just use `cd`. Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Diffstat (limited to 'run')
-rwxr-xr-xrun9
1 files changed, 3 insertions, 6 deletions
diff --git a/run b/run
index 3dfa63f..8078ce9 100755
--- a/run
+++ b/run
@@ -1,7 +1,4 @@
#!/usr/bin/env sh
-
-BASE_DIR="$(cd $(dirname "$0"); pwd)"
-
-cd "$BASE_DIR"
-
-python -m websockify $@
+set -e
+cd "$(dirname "$0")"
+exec python -m websockify "$@"