HPI-Information-Systems/Metanome

Make `run.sh` more portable

Opened this issue · 0 comments

The run.sh can be more portable by including a shebang line and not relying on an implementation detail. The trap should take signal names without the "SIG" prefix. From the posix man pages:

The condition can be [...] a signal specified using a symbolic name, without the SIG prefix [...], for example, HUP, INT, QUIT, TERM. Implementations may permit names with the SIG prefix or ignore case in signal names as an extension.

One prominent example of a shell used for /bin/sh is dash (for example: Ubuntu), which does not permit the "SIG" prefix.

diff --git a/deployment/configs/local/run.sh b/deployment/configs/local/run.sh
index a9e0a5d7..5aa6e229 100755
--- a/deployment/configs/local/run.sh
+++ b/deployment/configs/local/run.sh
@@ -1,5 +1,7 @@
+#!/bin/sh
+
 echo "This script does not support Microsoft Windows please use the run.bat script.\n"
 
-trap 'kill %1' SIGINT
+trap 'kill %1' INT
 java -Xmx2g -jar webapp-runner.jar backend --port 8081  &
 java -Xmx2g -jar webapp-runner.jar frontend