3849b5061c
This reverts commit ffe258d2d4.
Reason for revert: Failures on bots
Original change's description:
> [ VM / DartDev ] Launch DartDev in an isolate within a single main Dart process
>
> This CL changes how DartDev is run and how the run command handles executing a Dart program (will port additional commands in a separate CL). Rather than using DartDev to spawn a child process to run user code, the VM will instead launch a DartDev isolate after doing some VM options processing. DartDev will communicate information like exit codes and script/arg pairs with the VM via isolate ports. Once DartDev runs to completion and notifies the VM that a script should be run, the VM will move on to spawning another isolate with user code and continue executing in the same VM process.
>
> By moving DartDev into an isolate within the same process that user code will eventually run in we're able to resolve the following issues that arose due to signal handling and IPC issues:
>
> VM hangs when --enable-vm-service is supplied and there are compile time errors (https://github.com/dart-lang/sdk/issues/42630)
> Dart daemon spinning in exit code handler / zombie Dart processes (https://github.com/dart-lang/sdk/issues/41978)
> Signal handling in children of 'dartdev run' is problematic (https://github.com/dart-lang/sdk/issues/41978)
>
> Change-Id: I1c6b1425831b691ad20284716aa80f817dbaf607
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152588
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>
TBR=bkonyi@google.com,rmacnak@google.com,asiva@google.com
Change-Id: Idb1d24a4524bdc3ccfb199a82710f3c0d9db539a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154702
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
54 lines
1.7 KiB
C++
54 lines
1.7 KiB
C++
// Copyright (c) 2020, 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.
|
|
|
|
#include "bin/dartdev_utils.h"
|
|
|
|
#include <memory>
|
|
|
|
#include "bin/directory.h"
|
|
#include "bin/exe_utils.h"
|
|
#include "bin/file.h"
|
|
#include "platform/utils.h"
|
|
|
|
namespace dart {
|
|
namespace bin {
|
|
|
|
bool DartDevUtils::ShouldParseCommand(const char* script_uri) {
|
|
// If script_uri is not a file path or of a known URI scheme, we can assume
|
|
// that this is a DartDev command.
|
|
return (!File::ExistsUri(nullptr, script_uri) &&
|
|
(strncmp(script_uri, "http://", 7) != 0) &&
|
|
(strncmp(script_uri, "https://", 8) != 0) &&
|
|
(strncmp(script_uri, "file://", 7) != 0) &&
|
|
(strncmp(script_uri, "package:", 8) != 0) &&
|
|
(strncmp(script_uri, "google3://", 10) != 0));
|
|
}
|
|
|
|
bool DartDevUtils::TryResolveDartDevSnapshotPath(char** script_name) {
|
|
// |dir_prefix| includes the last path seperator.
|
|
auto dir_prefix = EXEUtils::GetDirectoryPrefixFromExeName();
|
|
|
|
// First assume we're in dart-sdk/bin.
|
|
char* snapshot_path =
|
|
Utils::SCreate("%ssnapshots/dartdev.dart.snapshot", dir_prefix.get());
|
|
if (File::Exists(nullptr, snapshot_path)) {
|
|
*script_name = snapshot_path;
|
|
return true;
|
|
}
|
|
free(snapshot_path);
|
|
|
|
// If we're not in dart-sdk/bin, we might be in one of the $SDK/out/*
|
|
// directories. Try to use a snapshot from a previously built SDK.
|
|
snapshot_path = Utils::SCreate("%sdartdev.dart.snapshot", dir_prefix.get());
|
|
if (File::Exists(nullptr, snapshot_path)) {
|
|
*script_name = snapshot_path;
|
|
return true;
|
|
}
|
|
free(snapshot_path);
|
|
return false;
|
|
}
|
|
|
|
} // namespace bin
|
|
} // namespace dart
|