compiler-discord/docker/pascal/run.sh

15 lines
254 B
Bash
Raw Normal View History

mkdir "$CODEDIR" && cd "$CODEDIR"
printf %s "$1" > program.pas
2019-03-13 05:37:28 +01:00
# fpc does not use stderr, ld however does, capture both
res="$(fpc program.pas 2>&1)"
if [ $? -eq 0 ]; then
./program || true
2019-03-13 05:37:28 +01:00
else
printf %s "$res"
2019-03-13 05:37:28 +01:00
fi
cd .. && rm -rf "$CODEDIR"