Skip to content

Commit 37cea50

Browse files
committed
zerocracy#252: Harden entry.sh with input validation and safer defaults
1 parent cb30a31 commit 37cea50

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

entry.sh

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# SPDX-FileCopyrightText: Copyright (c) 2024-2026 Zerocracy
33
# SPDX-License-Identifier: MIT
44

5-
set -ex
5+
set -e
66
set -o pipefail
77

88
id=$1
@@ -17,7 +17,17 @@ if [ -z "${home}" ]; then
1717
exit 1
1818
fi
1919

20-
self=$(dirname "$0")
20+
if [ ! -d "${home}" ]; then
21+
echo "Directory '${home}' does not exist"
22+
exit 1
23+
fi
24+
25+
if ! command -v judges &>/dev/null; then
26+
echo "'judges' executable not found. Make sure the 'judges' gem is installed."
27+
exit 1
28+
fi
29+
30+
self=$(cd "$(dirname "$0")" && pwd)
2131

22-
judges --verbose update --quiet --summary --max-cycles=3 --no-log \
32+
judges update --summary --max-cycles=3 --no-log \
2333
--option "id=${id}" --lib "${self}/lib" "${self}/judges" "${home}/base.fb"

0 commit comments

Comments
 (0)