diff options
author | Anders Kaseorg <andersk@mit.edu> | 2019-08-17 11:25:29 -0700 |
---|---|---|
committer | Anders Kaseorg <andersk@mit.edu> | 2019-08-17 11:39:46 -0700 |
commit | 5052f823d74241d099688c3a8ceb0de57541e968 (patch) | |
tree | 3cbe02e43bca0ee6eccc1177ef328d0e379f081c /run | |
parent | 654cbac77ea07819ed3bcf1ce6410be0211c0f1a (diff) | |
download | websockify-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-x | run | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -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 "$@" |