|
#!/bin/sh |
|
|
|
|
|
|
|
|
|
source="t-guild-compile-$$" |
|
target="$source.go" |
|
|
|
trap 'rm -f "$source" "$target"' EXIT |
|
|
|
cat > "$source"<<EOF |
|
(eval-when (expand load eval) |
|
;; Wait for SIGINT, if the pause function exists. |
|
(if (defined? 'pause) (pause) (exit 77)) |
|
|
|
;; Then sleep so that the SIGINT handler gets to run |
|
;; and compilation doesn't complete before it runs. |
|
(sleep 100)) |
|
(define chbouib 42) |
|
EOF |
|
|
|
guild compile -o "$target" "$source" & |
|
pid="$!" |
|
|
|
|
|
sleep 2 && kill -INT "$pid" |
|
|
|
|
|
sleep 2 |
|
|
|
|
|
for file in "$target"* |
|
do |
|
if test "$file" != "${target}*" |
|
then |
|
echo "error: 'guild compile' failed to remove '$file'" >&2 |
|
rm "$target"* |
|
kill "$pid" |
|
exit 1 |
|
fi |
|
done |
|
|
|
if test -f "$target" |
|
then |
|
echo "error: '$target' produced" >&2 |
|
exit 1 |
|
fi |
|
|