b3c579d3ee
This reverts commitc2095cb347. Reason for revert: These changes are blocking the Dart SDK -> Flutter roll because they cause some Fuchsia tests to fail. Original change's description: > Reland "[VM/Service] Shut down the VM immediately after the VM Service fails to start during VM initialization" > > This reverts commitd510876d9e. > > Reason for revert: g3 and Golem have been made compatible with this CL. > See b/409535026 and > https://chrome-internal-review.googlesource.com/c/golem/+/8345341. > > TEST=pkg/vm_service/test/failure_to_start_vm_service_after_vm_is_initialized_test, > pkg/vm_service/test/failure_to_start_vm_service_during_vm_initialization_test > > Original change's description: > > Revert "[VM/Service] Shut down the VM immediately after the VM Service fails to start during VM initialization" > > > > This reverts commit56ccf437e6. > > > > Reason for revert: b/409535026 > > > > TEST=ci > > > > Original change's description: > > > [VM/Service] Shut down the VM immediately after the VM Service fails to start during VM initialization > > > > > > TEST=pkg/vm_service/test/failure_to_start_vm_service_after_vm_is_initialized_test, > > > pkg/vm_service/test/failure_to_start_vm_service_during_vm_initialization_test > > > > > > Fixes: https://github.com/dart-lang/sdk/issues/60256 > > > Change-Id: I0543ab26e5721a4048136f27e8f4429bef04920f > > > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/416300 > > > Commit-Queue: Derek Xu <derekx@google.com> > > > Reviewed-by: Ben Konyi <bkonyi@google.com> > > > > Change-Id: I61eb42f0f00ad97e95e3ebf19990fe75d2d416aa > > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/421622 > > Reviewed-by: Derek Xu <derekx@google.com> > > Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com> > > Reviewed-by: Ben Konyi <bkonyi@google.com> > > Change-Id: Ieba880b7b298e491055c3f6049bab6772b1f8aa3 > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/434960 > Reviewed-by: Ben Konyi <bkonyi@google.com> > Commit-Queue: Derek Xu <derekx@google.com> No-Presubmit: true No-Tree-Checks: true No-Try: true Change-Id: I03b2371728de91e4e20008a879280c1ccab4d07c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/435540 Reviewed-by: Alexander Markov <alexmarkov@google.com> Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> Commit-Queue: Derek Xu <derekx@google.com>
47 lines
1.7 KiB
Dart
47 lines
1.7 KiB
Dart
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'dart:convert';
|
|
import 'dart:io';
|
|
|
|
// TODO(bkonyi): Share this logic with _ServiceTesteeRunner.launch.
|
|
Future<(Process, Uri)> spawnDartProcess(
|
|
String script, {
|
|
bool serveObservatory = true,
|
|
bool pauseOnStart = true,
|
|
bool disableServiceAuthCodes = false,
|
|
bool subscribeToStdio = true,
|
|
}) async {
|
|
final executable = Platform.executable;
|
|
final tmpDir = await Directory.systemTemp.createTemp('dart_service');
|
|
final serviceInfoUri = tmpDir.uri.resolve('service_info.json');
|
|
final serviceInfoFile = await File.fromUri(serviceInfoUri).create();
|
|
|
|
final arguments = [
|
|
'--no-dds',
|
|
'--observe=0',
|
|
if (!serveObservatory) '--no-serve-observatory',
|
|
if (pauseOnStart) '--pause-isolates-on-start',
|
|
if (disableServiceAuthCodes) '--disable-service-auth-codes',
|
|
'--write-service-info=$serviceInfoUri',
|
|
...Platform.executableArguments,
|
|
Platform.script.resolve(script).toString(),
|
|
];
|
|
final process = await Process.start(executable, arguments);
|
|
if (subscribeToStdio) {
|
|
process.stdout
|
|
.transform(utf8.decoder)
|
|
.listen((line) => print('TESTEE OUT: $line'));
|
|
process.stderr
|
|
.transform(utf8.decoder)
|
|
.listen((line) => print('TESTEE ERR: $line'));
|
|
}
|
|
while ((await serviceInfoFile.length()) <= 5) {
|
|
await Future.delayed(const Duration(milliseconds: 50));
|
|
}
|
|
final content = await serviceInfoFile.readAsString();
|
|
final infoJson = json.decode(content);
|
|
return (process, Uri.parse(infoJson['uri']));
|
|
}
|