Correctly report error when target dir does not exist.
If ./default.do knows how to build x/y/z, then we will run ./default.do x/y/z x/y/z x__y__z.redo2.tmp which can correctly generate $3, but then we can fail to rename it to x/y/z because x/y doesn't exist. This would previously through an exception. Now it prints a helpful error message. default.do may create x/y, in which case renaming will succeed.
This commit is contained in:
parent
34669fba65
commit
74f968d6ca
1 changed files with 9 additions and 1 deletions
|
|
@ -244,7 +244,15 @@ class BuildJob:
|
||||||
rv = 207
|
rv = 207
|
||||||
if rv==0:
|
if rv==0:
|
||||||
if st2:
|
if st2:
|
||||||
|
try:
|
||||||
os.rename(self.tmpname2, t)
|
os.rename(self.tmpname2, t)
|
||||||
|
except OSError, e:
|
||||||
|
dnt = os.path.dirname(t)
|
||||||
|
if not os.path.exists(dnt):
|
||||||
|
err('%s: target dir %r does not exist!\n' % (t, dnt))
|
||||||
|
else:
|
||||||
|
err('%s: rename %s: %s\n' % (t, self.tmpname2, e))
|
||||||
|
raise
|
||||||
os.unlink(self.tmpname1)
|
os.unlink(self.tmpname1)
|
||||||
elif st1.st_size > 0:
|
elif st1.st_size > 0:
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue