compiler-discord/docker/pascal/run.sh
2019-06-01 01:04:15 -04:00

15 lines
251 B
Bash

mkdir "$CODEDIR" && cd "$CODEDIR"
printf %s "$1" > program.pas
# fpc does not use stderr, ld however does, capture both
res="$(fpc program.pas 2>&1)"
if [ $? -eq 0 ]; then
./program
else
printf %s "$res"
exit 1
fi
cd .. && rm -rf "$CODEDIR"