Skip to content

Commit 35c5046

Browse files
authored
Add environment to SubprocessException, for improved debugging (#3841)
1 parent 23c8f18 commit 35c5046

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

tool/src/subprocess_launcher.dart

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,11 @@ class SubprocessLauncher {
129129

130130
if (exitCode != 0) {
131131
throw SubprocessException(
132-
command: [executable, ...arguments].join(' '),
133-
workingDirectory: workingDirectory,
134-
exitCode: exitCode);
132+
command: [executable, ...arguments].join(' '),
133+
workingDirectory: workingDirectory,
134+
exitCode: exitCode,
135+
environment: environment,
136+
);
135137
}
136138
return jsonObjects;
137139
}
@@ -182,15 +184,19 @@ class SubprocessException implements Exception {
182184
final String command;
183185
final String? workingDirectory;
184186
final int exitCode;
187+
final Map<String, String> environment;
185188

186-
SubprocessException(
187-
{required this.command,
188-
required this.workingDirectory,
189-
required this.exitCode});
189+
SubprocessException({
190+
required this.command,
191+
required this.workingDirectory,
192+
required this.environment,
193+
required this.exitCode,
194+
});
190195

191196
@override
192197
String toString() => 'SubprocessException['
193198
'command: "$command", '
194199
'workingDirectory: "${workingDirectory ?? '(null)'}", '
195-
'exitCode: $exitCode]';
200+
'exitCode: $exitCode, '
201+
'environment: $environment]';
196202
}

0 commit comments

Comments
 (0)