sx: test -a may not be short-circuiting
I was under the false assumption that -a, like &&, was used short-circuit semantics. However the behaviour of -a is not specified by POSIX. At least on Linux using bash or dash the behaviour is not short-circuiting. As there's no reason to test the RHS if the LHS is false I've switched back to [ ] && notation which is defined to be short-circuiting.
This commit is contained in:
parent
f783766e2c
commit
24a0495086
2
sx
2
sx
|
@ -12,7 +12,7 @@ cleanup() {
|
||||||
# regardless of failure.
|
# regardless of failure.
|
||||||
set +o errexit
|
set +o errexit
|
||||||
|
|
||||||
if test "$1" -a "$(ps -o comm= "$1")" = Xorg; then
|
if [ "$1" ] && [ "$(ps -o comm= "$1")" = Xorg ]; then
|
||||||
kill "$1"
|
kill "$1"
|
||||||
|
|
||||||
# Send SIGKILL after 10 seconds if the xserver is taking too long to
|
# Send SIGKILL after 10 seconds if the xserver is taking too long to
|
||||||
|
|
Loading…
Reference in New Issue