summaryrefslogtreecommitdiff
path: root/bench
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-10-06 13:32:25 -0700
committerOri Bernstein <ori@eigenstate.org>2015-10-06 13:32:25 -0700
commit3400b0428b9147012553c6f2280147d8dc99bbf1 (patch)
tree0a8b3d4e904963535bff3da1b9d81a1f51084261 /bench
parentc4d04d5ed7a782baf87e5beea2a2d95e31bebc5b (diff)
downloadmc-3400b0428b9147012553c6f2280147d8dc99bbf1.tar.gz
Fix up error handling for syswrap+posixy.myr
Diffstat (limited to 'bench')
-rw-r--r--bench/runbench.myr17
1 files changed, 4 insertions, 13 deletions
diff --git a/bench/runbench.myr b/bench/runbench.myr
index f30691e..ece5aa2 100644
--- a/bench/runbench.myr
+++ b/bench/runbench.myr
@@ -13,15 +13,6 @@ const main = {args : byte[:][:]
std.put("total:\t{}s\n", tot);
}
-
-generic perror = {a : @a::(numeric,integral), msg : byte[:] -> @a
- if a < 0
- std.fatal("{}", msg)
- else
- -> a
- ;;
-}
-
const timeit = {prog -> flt64
var avg, m, d, x, n : flt64
@@ -49,10 +40,10 @@ const run = {prog -> flt64
if pid < 0
std.fatal("Could not fork\n");
elif pid == 0
- infd = perror(std.open("/dev/zero", std.Ordonly), "could not open /dev/zero")
- outfd = perror(std.open("/dev/null", std.Owronly), "could not open /dev/null")
- perror(std.dup2(infd, 0), "could not redirect stdin")
- perror(std.dup2(outfd, 1), "could not redirect stdout")
+ infd = std.try(std.open("/dev/zero", std.Ordonly))
+ outfd = std.try(std.open("/dev/null", std.Owronly))
+ std.try(std.dup2(infd, 0))
+ std.try(std.dup2(outfd, 1))
std.execv(prog, [prog][:])
std.fatal("Failed to exec\n")
else