Skip to content

Commit

Permalink
Bug 837665 - Show command line and response file contents when expand…
Browse files Browse the repository at this point in the history
…libs_exec'ed command fails. r=ted
  • Loading branch information
glandium committed Feb 14, 2013
1 parent 8a1ade0 commit 2641038
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 18 deletions.
26 changes: 17 additions & 9 deletions config/expandlibs_exec.py
Expand Up @@ -267,6 +267,14 @@ def _getSymbols(obj):
syms.append((tmp[-1], tmp[0]))
return syms

def print_command(out, args):
print >>out, "Executing: " + " ".join(args)
for tmp in [f for f in args.tmp if os.path.isfile(f)]:
print >>out, tmp + ":"
with open(tmp) as file:
print >>out, "".join([" " + l for l in file.readlines()])
out.flush()

def main():
parser = OptionParser()
parser.add_option("--depend", dest="depend", metavar="FILE",
Expand Down Expand Up @@ -302,15 +310,15 @@ def main():
args.makelist()

if options.verbose:
print >>sys.stderr, "Executing: " + " ".join(args)
for tmp in [f for f in args.tmp if os.path.isfile(f)]:
print >>sys.stderr, tmp + ":"
with open(tmp) as file:
print >>sys.stderr, "".join([" " + l for l in file.readlines()])
sys.stderr.flush()
ret = subprocess.call(args)
if ret:
exit(ret)
print_command(sys.stderr, args)
proc = subprocess.Popen(args, stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
(stdout, stderr) = proc.communicate()
if proc.returncode and not options.verbose:
print_command(sys.stderr, args)
sys.stderr.write(stdout)
sys.stderr.flush()
if proc.returncode:
exit(proc.returncode)
if not options.depend:
return
ensureParentDir(options.depend)
Expand Down
26 changes: 17 additions & 9 deletions js/src/config/expandlibs_exec.py
Expand Up @@ -267,6 +267,14 @@ def _getSymbols(obj):
syms.append((tmp[-1], tmp[0]))
return syms

def print_command(out, args):
print >>out, "Executing: " + " ".join(args)
for tmp in [f for f in args.tmp if os.path.isfile(f)]:
print >>out, tmp + ":"
with open(tmp) as file:
print >>out, "".join([" " + l for l in file.readlines()])
out.flush()

def main():
parser = OptionParser()
parser.add_option("--depend", dest="depend", metavar="FILE",
Expand Down Expand Up @@ -302,15 +310,15 @@ def main():
args.makelist()

if options.verbose:
print >>sys.stderr, "Executing: " + " ".join(args)
for tmp in [f for f in args.tmp if os.path.isfile(f)]:
print >>sys.stderr, tmp + ":"
with open(tmp) as file:
print >>sys.stderr, "".join([" " + l for l in file.readlines()])
sys.stderr.flush()
ret = subprocess.call(args)
if ret:
exit(ret)
print_command(sys.stderr, args)
proc = subprocess.Popen(args, stdout = subprocess.PIPE, stderr = subprocess.STDOUT)
(stdout, stderr) = proc.communicate()
if proc.returncode and not options.verbose:
print_command(sys.stderr, args)
sys.stderr.write(stdout)
sys.stderr.flush()
if proc.returncode:
exit(proc.returncode)
if not options.depend:
return
ensureParentDir(options.depend)
Expand Down

0 comments on commit 2641038

Please sign in to comment.