updated
authorChristian Urban <christian.urban@kcl.ac.uk>
Fri, 26 Sep 2025 23:10:52 +0100
changeset 991 5d01eccc2036
parent 990 ef63ae3586b8
child 992 c3dd3a98f919
updated
progs/bf/bfc0.sc
progs/bf/bfc1.sc
--- a/progs/bf/bfc0.sc	Fri Sep 26 19:09:50 2025 +0100
+++ b/progs/bf/bfc0.sc	Fri Sep 26 23:10:52 2025 +0100
@@ -47,10 +47,11 @@
 // BF program and running the resulting binary
 
 def compile_and_run(prog: String) = {
-  val tn = "tmp"
+  val hash = java.util.UUID.randomUUID().toString.take(4)
+  val tn = s"tmp_$hash"
   compile_to_file(s"${tn}.c", prog)
   os.proc("gcc", "-O0", "-o", tn, s"${tn}.c").call() // call gcc
-  os.proc("./tmp").call(stdout = os.Inherit)         // run binary
+  os.proc(os.pwd / s"${tn}").call(stdout = os.Inherit)         // run binary
 }
 
 // Running Testcases
--- a/progs/bf/bfc1.sc	Fri Sep 26 19:09:50 2025 +0100
+++ b/progs/bf/bfc1.sc	Fri Sep 26 23:10:52 2025 +0100
@@ -59,10 +59,11 @@
 // BF program and running the resulting binary
 
 def compile_and_run(prog: String) = {
-  val tn = "tmp"
+  val hash = java.util.UUID.randomUUID().toString.take(4)
+  val tn = s"tmp_$hash"
   compile_to_file(s"${tn}.c", prog)
   os.proc("gcc", "-O0", "-o", tn, s"${tn}.c").call() // call gcc
-  os.proc("./tmp").call(stdout = os.Inherit)         // run binary
+  os.proc(os.pwd / s"${tn}").call(stdout = os.Inherit)         // run binary
 }
 
 // Running Testcases