Print a nicer error message when asked to build an empty string ('').

This happens sometimes, for example, if you do
	whatever | while read x; do
		redo-ifchange "$x"
	done
and the input contains blank lines.

We could ignore the request for blankness, but it seems like that
situation might indicate a more serious bug in your parser, so it's
probably better to just abort with a meaningful error.
This commit is contained in:
Avery Pennarun 2018-11-03 03:36:13 -04:00
commit 2a936a7574
4 changed files with 12 additions and 2 deletions

View file

@ -9,6 +9,9 @@ try:
os.path.join(vars.PWD, vars.TARGET))
f = state.File(name=me)
for t in sys.argv[1:]:
if not t:
err('cannot build the empty target ("").\n')
sys.exit(204)
if os.path.exists(t):
err('redo-ifcreate: error: %r already exists\n' % t)
sys.exit(1)