sourcegraph / srclib

srclib is a polyglot code analysis library, built for hackability. It consists of language analysis toolchains (currently for Go and Java, with Python, JavaScript, and Ruby in beta) with a common output format, and a CLI tool for running the analysis.
https://srclib.org
Other
942 stars 62 forks source link

cmd/src: Make it clearer that an error occurred #153

Closed keegancsmith closed 9 years ago

keegancsmith commented 9 years ago

Writes os.Args and err.Error() to stderr. This way you can also see failures in the subprocesses that src manages.

An example of failure output is

$ src make
fork/exec /Users/keegan/.srclib/sourcegraph.com/sourcegraph/srclib-python/.env/bin/virtualenv: no such file or directory
exit status 1
EOF
FAILED: src internal normalize-graph-data --unit-type PythonProgram --dir . - EOF
.srclib-cache/16a4943ad6c9d7cc333e64c7d1d366b2c461144e/PythonProgram.graph.json: command failed: src tool --methods program,docker "sourcegraph.com/sourcegraph/srclib-python" "graph" < .srclib-cache/16a4943ad6c9d7cc333e64c7d1d366b2c461144e/PythonProgram.unit.json | src internal normalize-graph-data --unit-type "PythonProgram" --dir . 1> .srclib-cache/16a4943ad6c9d7cc333e64c7d1d366b2c461144e/PythonProgram.graph.json (exit status 1)
command failed: src tool --methods program,docker "sourcegraph.com/sourcegraph/srclib-python" "graph" < .srclib-cache/16a4943ad6c9d7cc333e64c7d1d366b2c461144e/PythonProgram.unit.json | src internal normalize-graph-data --unit-type "PythonProgram" --dir . 1> .srclib-cache/16a4943ad6c9d7cc333e64c7d1d366b2c461144e/PythonProgram.graph.json (exit status 1)
FAILED: src make - command failed: src tool --methods program,docker "sourcegraph.com/sourcegraph/srclib-python" "graph" < .srclib-cache/16a4943ad6c9d7cc333e64c7d1d366b2c461144e/PythonProgram.unit.json | src internal normalize-graph-data --unit-type "PythonProgram" --dir . 1> .srclib-cache/16a4943ad6c9d7cc333e64c7d1d366b2c461144e/PythonProgram.graph.json (exit status 1)
dmitshur commented 9 years ago

Thanks a lot, this was on my mind as one of things I wanted to fix!

jelmerdereus commented 9 years ago

@keegancsmith cool! thanks