Verbose process exceptions (#61552)
This commit is contained in:
committed by
GitHub
parent
9ef8192760
commit
f796e047fd
@@ -226,6 +226,7 @@ class _PosixUtils extends OperatingSystemUtils {
|
||||
_processUtils.runSync(
|
||||
<String>['unzip', '-o', '-q', file.path, '-d', targetDirectory.path],
|
||||
throwOnError: true,
|
||||
verboseExceptions: true,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -231,6 +231,7 @@ abstract class ProcessUtils {
|
||||
RunResult runSync(
|
||||
List<String> cmd, {
|
||||
bool throwOnError = false,
|
||||
bool verboseExceptions = false,
|
||||
RunResultChecker allowedFailures,
|
||||
bool hideStdout = false,
|
||||
String workingDirectory,
|
||||
@@ -408,6 +409,7 @@ class _DefaultProcessUtils implements ProcessUtils {
|
||||
RunResult runSync(
|
||||
List<String> cmd, {
|
||||
bool throwOnError = false,
|
||||
bool verboseExceptions = false,
|
||||
RunResultChecker allowedFailures,
|
||||
bool hideStdout = false,
|
||||
String workingDirectory,
|
||||
@@ -449,7 +451,12 @@ class _DefaultProcessUtils implements ProcessUtils {
|
||||
}
|
||||
|
||||
if (failedExitCode && throwOnError) {
|
||||
runResult.throwException('The command failed');
|
||||
String message = 'The command failed';
|
||||
if (verboseExceptions) {
|
||||
message = 'The command failed\nStdout:\n${runResult.stdout}\n'
|
||||
'Stderr:\n${runResult.stderr}';
|
||||
}
|
||||
runResult.throwException(message);
|
||||
}
|
||||
|
||||
return runResult;
|
||||
|
||||
Reference in New Issue
Block a user