If the .do script deletes $3, don't die.
This commit is contained in:
parent
abbde40a4f
commit
c7585558ef
5 changed files with 12 additions and 4 deletions
|
|
@ -38,7 +38,7 @@ _do()
|
|||
export DO_DEPTH="$DO_DEPTH "
|
||||
. "$PWD/$DOFILE" >"$TARGET.tmp"
|
||||
) &&
|
||||
mv "$TARGET.tmp" "$TARGET"
|
||||
mv "$TARGET.tmp" "$TARGET" 2>/dev/null || touch "$TARGET"
|
||||
else
|
||||
echo "do $DO_DEPTH$TARGET exists." >&2
|
||||
fi
|
||||
|
|
|
|||
6
redo.py
6
redo.py
|
|
@ -134,10 +134,12 @@ def _build(t):
|
|||
log('%s\n' % relpath(t, vars.STARTDIR))
|
||||
rv = subprocess.call(argv, preexec_fn=lambda: _preexec(t),
|
||||
stdout=f.fileno())
|
||||
st = os.stat(tmpname)
|
||||
stampfile = sname('stamp', t)
|
||||
if rv==0:
|
||||
if st.st_size:
|
||||
if os.path.exists(tmpname) and os.stat(tmpname).st_size:
|
||||
# there's a race condition here, but if the tmpfile disappears
|
||||
# at *this* point you deserve to get an error, because you're
|
||||
# doing something totally scary.
|
||||
os.rename(tmpname, t)
|
||||
else:
|
||||
unlink(tmpname)
|
||||
|
|
|
|||
3
t/all.do
3
t/all.do
|
|
@ -1,2 +1,3 @@
|
|||
redo-ifchange hello yellow bellow c d
|
||||
redo-ifchange hello yellow bellow c d deltest deltest2
|
||||
|
||||
|
||||
|
|
|
|||
2
t/deltest.do
Normal file
2
t/deltest.do
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
# remove an empty output file
|
||||
rm -f $3
|
||||
3
t/deltest2.do
Normal file
3
t/deltest2.do
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# delete a non-empty output file
|
||||
echo hello
|
||||
rm -f $3
|
||||
Loading…
Add table
Add a link
Reference in a new issue