Commit e182041f authored by Ian Lynagh's avatar Ian Lynagh
Browse files

Handle missing stderr files

Sometimes, "prog 2> err" won't actually create err on Windows.
parent 948c82d8
...@@ -979,7 +979,7 @@ def simple_build( name, way, extra_hc_opts, should_fail, top_mod, link, addsuf, ...@@ -979,7 +979,7 @@ def simple_build( name, way, extra_hc_opts, should_fail, top_mod, link, addsuf,
if result != 0 and not should_fail: if result != 0 and not should_fail:
actual_stderr = qualify(name, 'comp.stderr') actual_stderr = qualify(name, 'comp.stderr')
if_verbose(1,'Compile failed (status ' + `result` + ') errors were:') if_verbose(1,'Compile failed (status ' + `result` + ') errors were:')
if_verbose(1,open(actual_stderr).read()) if_verbose_dump(1,actual_stderr)
# ToDo: if the sub-shell was killed by ^C, then exit # ToDo: if the sub-shell was killed by ^C, then exit
...@@ -1241,7 +1241,7 @@ def extcore_run( name, way, extra_hc_opts, compile_only, top_mod ): ...@@ -1241,7 +1241,7 @@ def extcore_run( name, way, extra_hc_opts, compile_only, top_mod ):
if exit_code != 0: if exit_code != 0:
if_verbose(1,'Compiling to External Core failed (status ' + `result` + ') errors were:') if_verbose(1,'Compiling to External Core failed (status ' + `result` + ') errors were:')
if_verbose(1,open(qerrname).read()) if_verbose_dump(1,qerrname)
return failBecause('ext core exit code non-0') return failBecause('ext core exit code non-0')
# Compile the resulting files -- if there's more than one module, we need to read the output # Compile the resulting files -- if there's more than one module, we need to read the output
...@@ -1272,7 +1272,7 @@ def extcore_run( name, way, extra_hc_opts, compile_only, top_mod ): ...@@ -1272,7 +1272,7 @@ def extcore_run( name, way, extra_hc_opts, compile_only, top_mod ):
if exit_code != 0: if exit_code != 0:
if_verbose(1,'Compiling External Core file(s) failed (status ' + `result` + ') errors were:') if_verbose(1,'Compiling External Core file(s) failed (status ' + `result` + ') errors were:')
if_verbose(1,open(qerrname).read()) if_verbose_dump(1,qerrname)
return failBecause('ext core exit code non-0') return failBecause('ext core exit code non-0')
# Clean up # Clean up
...@@ -1468,6 +1468,13 @@ def if_verbose( n, str ): ...@@ -1468,6 +1468,13 @@ def if_verbose( n, str ):
if config.verbose >= n: if config.verbose >= n:
print str print str
def if_verbose_dump( n, f ):
if config.verbose >= n:
try:
print open(f).read()
except:
print ''
# Guess flags suitable for the compiler. # Guess flags suitable for the compiler.
def guess_compiler_flags(): def guess_compiler_flags():
if config.compiler_type == 'ghc': if config.compiler_type == 'ghc':
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment