diff options
| author | Michael Forney <mforney@mforney.org> | 2016-04-16 02:02:51 -0700 |
|---|---|---|
| committer | Michael Forney <mforney@mforney.org> | 2016-04-16 02:02:51 -0700 |
| commit | 00b7a0a40be589731b43df4934108f628a407f6b (patch) | |
| tree | 0b02d28b4d587d4c0cdd5a29a245bac001e0038d /setup.rc | |
| parent | 142c5870a9b6ba6f4d7af7bbdf46a72c22ee2983 (diff) | |
Write to local.ninja.tmp first in case generation fails
Diffstat (limited to 'setup.rc')
| -rwxr-xr-x | setup.rc | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -32,6 +32,7 @@ fn gen { if not dir=$dir/$1 cd $1 + ifs=() { oldcwd=`{pwd | head -c -1} } tree_perms=() perms_inputs=() @@ -45,7 +46,6 @@ fn gen { set outdir $outdir } - ifs=() { oldcwd=`{pwd | head -c -1} } . ./gen.rc build 'phony/$srcdir/gen' phony '$srcdir'/local.ninja $gen_inputs @@ -59,7 +59,8 @@ fn gen { if not build '$outdir/root.perms' cat $perms_inputs if(~ $#tree_inputs 0) build '$outdir/root.tree' stamp if not build '$outdir/root.tree' cat $tree_inputs - } >local.ninja + } >local.ninja.tmp + mv $oldcwd/^( local.ninja.tmp local.ninja ) if(! ~ $quiet 1) echo 'generated '$dir >[1=2] status=() |
