This reverts commit 7750872251.
This commit is contained in:
@@ -28,8 +28,9 @@ Future<Map<String, dynamic>> runTask(String taskName, { bool silent = false }) a
|
||||
if (!file(taskExecutable).existsSync())
|
||||
throw 'Executable Dart file not found: $taskExecutable';
|
||||
|
||||
final int vmServicePort = await findAvailablePort();
|
||||
final Process runner = await startProcess(dartBin, <String>[
|
||||
'--enable-vm-service=0',
|
||||
'--enable-vm-service=$vmServicePort',
|
||||
'--no-pause-isolates-on-exit',
|
||||
taskExecutable,
|
||||
]);
|
||||
@@ -40,17 +41,10 @@ Future<Map<String, dynamic>> runTask(String taskName, { bool silent = false }) a
|
||||
runnerFinished = true;
|
||||
});
|
||||
|
||||
final Completer<int> port = new Completer<int>();
|
||||
|
||||
final StreamSubscription<String> stdoutSub = runner.stdout
|
||||
.transform(const Utf8Decoder())
|
||||
.transform(const LineSplitter())
|
||||
.listen((String line) {
|
||||
if (!port.isCompleted) {
|
||||
final int portValue = parseServicePort(line, prefix: 'Observatory listening on ');
|
||||
if (portValue != null)
|
||||
port.complete(portValue);
|
||||
}
|
||||
if (!silent) {
|
||||
stdout.writeln('[$taskName] [STDOUT] $line');
|
||||
}
|
||||
@@ -65,7 +59,7 @@ Future<Map<String, dynamic>> runTask(String taskName, { bool silent = false }) a
|
||||
|
||||
String waitingFor = 'connection';
|
||||
try {
|
||||
final VMIsolateRef isolate = await _connectToRunnerIsolate(await port.future);
|
||||
final VMIsolateRef isolate = await _connectToRunnerIsolate(vmServicePort);
|
||||
waitingFor = 'task completion';
|
||||
final Map<String, dynamic> taskResult =
|
||||
await isolate.invokeExtension('ext.cocoonRunTask').timeout(taskTimeoutWithGracePeriod);
|
||||
|
||||
Reference in New Issue
Block a user