Skip to content

Commit 5052f82

Browse files
committed
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 <[email protected]>
1 parent 654cbac commit 5052f82

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

run

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
#!/usr/bin/env sh
2-
3-
BASE_DIR="$(cd $(dirname "$0"); pwd)"
4-
5-
cd "$BASE_DIR"
6-
7-
python -m websockify $@
2+
set -e
3+
cd "$(dirname "$0")"
4+
exec python -m websockify "$@"

0 commit comments

Comments
 (0)