print copy-pastable compilation command in case of failure

Summary: public
This makes it a bit easier to diagnose errors. This is how it looks:

  infer -- javac IDontExist.java
  "javac" "-g" "-cp" "/home/jul/infer/infer/lib/python/inferlib/../../../../infer/lib/java/processor.jar" "-d" "/home/jul/infer/examples" "IDontExist.java" "-J-Duser.language=en"

This is how it used to look:

  ['javac', '-g', '-cp', u'/home/jul/code/infer/infer/bin/../lib/java/processor.jar', '-d', '/home/jul/infer/examples', 'IDontExist.java', '-J-Duser.language=en']

Reviewed By: jberdine

Differential Revision: D2631698

fb-gh-sync-id: 09903df
master
Jules Villard 9 years ago committed by facebook-github-bot-7
parent 6bf9f47c14
commit d0d0a5efa0

@ -86,9 +86,9 @@ class CompilerCall:
try:
subprocess.check_call(javac_cmd, stderr=file_out)
except subprocess.CalledProcessError:
error_msg = 'Javac compilation error with: \n\n{}\n'
failing_cmd = [arg for arg in javac_cmd
if arg != '-verbose']
error_msg = 'ERROR: Failed to run the following compilation command:\n\n {}\n'
failing_cmd = ' '.join(['"%s"' % arg for arg in javac_cmd
if arg != '-verbose'])
utils.error(error_msg.format(failing_cmd))
subprocess.check_call(failing_cmd)

Loading…
Cancel
Save