summaryrefslogtreecommitdiff
path: root/mbld
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2016-01-07 00:52:15 -0800
committerOri Bernstein <ori@eigenstate.org>2016-01-07 00:52:48 -0800
commitd7876137098f38e8ba0575ddf8b9f925a3dd6d08 (patch)
tree2864a43a903a8e0f6a9e14bcffd6408200dbe946 /mbld
parentc3e6c525d4716fdaa8839119f4d487f76401f272 (diff)
downloadmc-d7876137098f38e8ba0575ddf8b9f925a3dd6d08.tar.gz
Fix runmyr.
We need a temp file that we can clobber. Not ideal, but that's how it works.
Diffstat (limited to 'mbld')
-rw-r--r--mbld/main.myr14
1 files changed, 5 insertions, 9 deletions
diff --git a/mbld/main.myr b/mbld/main.myr
index 30ef52a..d29daa7 100644
--- a/mbld/main.myr
+++ b/mbld/main.myr
@@ -20,6 +20,7 @@ const main = {args : byte[:][:]
var bintarg
var targname
var runsrc
+ var tmp
var cmd
var tags
@@ -87,15 +88,10 @@ const main = {args : byte[:][:]
if targname.len != 0
buildimm(b, targname, cmd.args, bintarg, cleanfirst)
elif runsrc.len != 0
- match std.mktemp("run", std.Ordwr, 0o755)
- | `std.Ok (fd, tmp):
- buildimm(b, "/tmp/foo", [runsrc][:], true, cleanfirst)
- runcmd("/tmp/foo", cmd.args)
- std.remove(tmp)
- std.close(fd)
- | `std.Fail e:
- std.put("unable to open tmp file: {}\n", e)
- ;;
+ tmp = std.mktemppath("runmyr")
+ buildimm(b, tmp, [runsrc][:], true, cleanfirst)
+ runcmd(tmp, cmd.args)
+ std.remove(tmp)
elif dumponly
findproj(b, "bld.proj")
bld.load(b)