Skip to content

Commit

Permalink
Combine all args in _runInShell() and also throw exception on bad res…
Browse files Browse the repository at this point in the history
…ult code
  • Loading branch information
matthew-carroll committed Jan 4, 2025
1 parent 6d58884 commit 1c5f28a
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,9 +184,15 @@ class Xcrun {
}

static Future<ProcessResult> _runInShell(List<String> commandAndArgs) async {
print("Sending shell command: '${commandAndArgs.join(" ")}'");
final result = await Process.run("sh", ["--verbose", "--debug", "-c", ...commandAndArgs]);
final command = commandAndArgs.join(" ");
print("Sending shell command: '$command'");
final result = await Process.run("sh", ["--verbose", "--debug", "-c", command]);
print("Shell command exit code: ${result.exitCode}");

if (result.exitCode != 0) {
throw Exception("Failed to execute command in a shell:\n'$command'\nExit code: ${result.exitCode}");
}

return result;

// return Process.run(
Expand Down

0 comments on commit 1c5f28a

Please sign in to comment.