@@ -106,7 +106,7 @@ void main(List<String> args) async {
106
106
var ddcPath = p.dirname (p.dirname (toolPath));
107
107
var dartCheckoutPath = p.dirname (p.dirname (ddcPath));
108
108
109
- ProcessResult runDdc (String command, List <String > args) {
109
+ Future < void > runDdc (String command, List <String > args) async {
110
110
if (debug) {
111
111
// Use unbuilt script. This only works from a source checkout.
112
112
args.insertAll (
@@ -116,18 +116,9 @@ void main(List<String> args) async {
116
116
// Use built snapshot.
117
117
command = p.join (dartSdk, 'bin' , command);
118
118
}
119
- return Process .runSync (command, args);
120
- }
121
-
122
- /// Writes stdout and stderr from [result] to this process.
123
- ///
124
- /// Will exit with the exit code from [result] when it's not zero.
125
- void echoResult (ProcessResult result) async {
126
- stdout.write (result.stdout);
127
- await stdout.flush ();
128
- stderr.write (result.stderr);
129
- await stderr.flush ();
130
- if (result.exitCode != 0 ) exit (result.exitCode);
119
+ var process =
120
+ await Process .start (command, args, mode: ProcessStartMode .inheritStdio);
121
+ if (await process.exitCode != 0 ) exit (await process.exitCode);
131
122
}
132
123
133
124
String mod;
@@ -163,7 +154,6 @@ void main(List<String> args) async {
163
154
ddcSdk = p.join (
164
155
dartSdk, 'lib' , '_internal' , kernel ? 'ddc_sdk.dill' : 'ddc_sdk.sum' );
165
156
166
- ProcessResult result;
167
157
if (compile) {
168
158
var ddcArgs = [
169
159
if (kernel) '--kernel' ,
@@ -181,8 +171,7 @@ void main(List<String> args) async {
181
171
entry
182
172
];
183
173
184
- result = runDdc ('dartdevc' , ddcArgs);
185
- await echoResult (result);
174
+ await runDdc ('dartdevc' , ddcArgs);
186
175
}
187
176
188
177
if (run) {
@@ -222,13 +211,17 @@ void main(List<String> args) async {
222
211
File (htmlFile).writeAsStringSync (html);
223
212
var tmp = p.join (Directory .systemTemp.path, 'ddc' );
224
213
225
- result = Process .runSync (chromeBinary, [
226
- '--auto-open-devtools-for-tabs' ,
227
- '--allow-file-access-from-files' ,
228
- '--remote-debugging-port=$port ' ,
229
- '--user-data-dir=$tmp ' ,
230
- htmlFile
231
- ]);
214
+ var process = await Process .start (
215
+ chromeBinary,
216
+ [
217
+ '--auto-open-devtools-for-tabs' ,
218
+ '--allow-file-access-from-files' ,
219
+ '--remote-debugging-port=$port ' ,
220
+ '--user-data-dir=$tmp ' ,
221
+ htmlFile
222
+ ],
223
+ mode: ProcessStartMode .inheritStdio);
224
+ if (await process.exitCode != 0 ) exit (await process.exitCode);
232
225
} else if (node) {
233
226
var nodePath = '$sdkJsPath :$libRoot ' ;
234
227
var runjs = '''
@@ -253,9 +246,11 @@ try {
253
246
var nodeFile = p.setExtension (entry, '.run.js' );
254
247
File (nodeFile).writeAsStringSync (runjs);
255
248
var nodeBinary = binary ?? 'node' ;
256
- result = Process .runSync (
249
+ var process = await Process .start (
257
250
nodeBinary, ['--inspect=localhost:$port ' , nodeFile],
258
- environment: {'NODE_PATH' : nodePath});
251
+ environment: {'NODE_PATH' : nodePath},
252
+ mode: ProcessStartMode .inheritStdio);
253
+ if (await process.exitCode != 0 ) exit (await process.exitCode);
259
254
} else if (d8) {
260
255
// Fix SDK import. `d8` doesn't let us set paths, so we need a full path
261
256
// to the SDK.
@@ -280,9 +275,10 @@ try {
280
275
var d8File = p.setExtension (entry, '.d8.js' );
281
276
File (d8File).writeAsStringSync (runjs);
282
277
var d8Binary = binary ?? p.join (dartCheckoutPath, _d8executable);
283
- result = Process .runSync (d8Binary, ['--module' , d8File]);
278
+ var process = await Process .start (d8Binary, ['--module' , d8File],
279
+ mode: ProcessStartMode .inheritStdio);
280
+ if (await process.exitCode != 0 ) exit (await process.exitCode);
284
281
}
285
- await echoResult (result);
286
282
}
287
283
}
288
284
0 commit comments