Surface raw errors when check_output fails#2125
Conversation
Co-authored-by: Malcolm Smith <smith@chaquo.com>
|
There's at least one more call in Android which should be quiet, as I get this message every time I run Since |
Good catch - I audited the calls to adb in the android platform backend, but forgot that there was a bunch of them wrapped up in the Android integration itself - and this particular one only manifests when you have a physical Android device plugged in, so it didn't appear in my testing. I also spotted an extra one in the java backend - clearly I missed this in the volume of output that is generated at the start of a |
Briefcase generally attempts to provide actionable feedback to the user when things go wrong, and stay silent otherwise. However, there are many edge cases of command failure that result in Briefcase providing generic advice like "Unable to sign app" when the underlying command output provides useful context.
If the call was made with
subprocess.runorsubprocess.Popen, then this context will be visible. However, ifsubprocess.check_outputis used, the context will only be visible in the logs.This PR modifies
subprocess.check_outputso that in case of error, output is surfaced (with muted markup) so that any useful context can be seen by the user. This can be disabled by passingquiet=1(which will still log the output) orquiet=2(which won't log the output either).quiet=1is often needed when the failure is expected - such as when probing for whether Xcode has been installed. In this case, we look for specific error messages in the output, and if they're found, we return the specific actionable advice. If the expected text isn't present, we can reproduce the default output behavior. Essentially if we are doing any post-processing of the CalledProcessError, we should probably be using quiet=1.Fixes #1907
PR Checklist: