Skip to content

Commit dd8f228

Browse files
committed
debug functionality
1 parent c07b2c0 commit dd8f228

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

local.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,16 @@ tmp=`mktemp`.js
3535
# Separate compiler and runtime arguments
3636
compiler_args=""
3737
runtime_args=""
38+
keep_temp=false
3839

3940
for arg in "$@"; do
4041
case "$arg" in
4142
--no-color)
4243
runtime_args="$runtime_args $arg"
4344
;;
45+
--keep-temp)
46+
keep_temp=true
47+
;;
4448
*)
4549
compiler_args="$compiler_args $arg"
4650
;;
@@ -51,7 +55,11 @@ done
5155

5256
if [ $? -eq 0 ]; then
5357
eval "node --stack-trace-limit=1000 \"$TROUPE/rt/built/troupe.mjs\" -f=\"$tmp\" --localonly $runtime_args"
54-
rm "$tmp"
58+
if [ "$keep_temp" = false ]; then
59+
rm "$tmp"
60+
else
61+
echo "Temporary file kept at: $tmp"
62+
fi
5563
else
5664
exit $?
5765
fi

rt/src/builtins/UserRuntimeZero.mts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,10 @@ export class UserRuntimeZero {
8989
}
9090

9191

92+
debug (x) {
93+
this.runtime.debug(x);
94+
}
95+
9296
ret (x) {
9397
this.runtime.ret (x)
9498
}

0 commit comments

Comments
 (0)