Skip to content

Commit 31bb276

Browse files
committed
update.sh: remove temporary files even on ^C or errors
1 parent 96af716 commit 31bb276

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

playground/update.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
#!/bin/sh
22
set -e
33

4+
cleanup() {
5+
rm -rf /tmp/gopherjsplayground_gopath
6+
rm -rf /tmp/gopherjsplayground_goroot
7+
exit
8+
}
9+
10+
trap cleanup EXIT SIGHUP SIGINT SIGTERM
11+
412
go install github.com/gopherjs/gopherjs/...
513

614
go generate github.com/gopherjs/gopherjs.github.io/playground/internal/imports
@@ -131,8 +139,5 @@ gopherjs install -m \
131139
cp -r $GOROOT/pkg/*_js_min/* $PKG
132140
cp -r $GOROOT/pkg/*_amd64_js_min/* $PKG
133141

134-
rm -r /tmp/gopherjsplayground_goroot
135-
rm -r /tmp/gopherjsplayground_gopath
136-
137142
# Rename all *.a files in $PKG to *.a.js.
138143
find "$PKG" -name "*.a" -exec sh -c 'mv $0 $0.js' {} \;

0 commit comments

Comments
 (0)