mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 02:47:36 +00:00
[ CLI ] Make dart {compile,build} error exit codes consistent on Windows
Setting an error code of -1 on macOS and Linux results in an error code of 255 being set since negative error codes are subtracted from 256. However, an error code of -1 on Windows is not converted in the same way, resulting in a difference of behavior between OSes. This change updates -1 error codes to be 255 so they're the same on all OSes. Fixes https://github.com/dart-lang/sdk/issues/54857 Change-Id: Idcfbfab30d3cc31a9e4ca630b8d94caa03ef07b4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/351500 Reviewed-by: Daco Harkes <dacoharkes@google.com> Commit-Queue: Ben Konyi <bkonyi@google.com>
This commit is contained in:
parent
adee0a2399
commit
670b9ba9cf
|
@ -23,6 +23,7 @@ class BuildCommand extends DartdevCommand {
|
|||
static const String cmdName = 'build';
|
||||
static const String outputOptionName = 'output';
|
||||
static const String formatOptionName = 'format';
|
||||
static const int genericErrorExitCode = 255;
|
||||
|
||||
BuildCommand({bool verbose = false})
|
||||
: super(cmdName, 'Build a Dart application including native assets.',
|
||||
|
@ -83,7 +84,7 @@ class BuildCommand extends DartdevCommand {
|
|||
// Similar to Dart run. Possibly also in `dart compile`.
|
||||
final sourceUri = Uri(path: args.rest[0].normalizeCanonicalizePath());
|
||||
if (!checkFile(sourceUri.toFilePath())) {
|
||||
return -1;
|
||||
return genericErrorExitCode;
|
||||
}
|
||||
|
||||
final outputUri = Uri.directory(
|
||||
|
|
|
@ -19,6 +19,7 @@ import '../native_assets.dart';
|
|||
import '../sdk.dart';
|
||||
import '../utils.dart';
|
||||
|
||||
const int genericErrorExitCode = 255;
|
||||
const int compileErrorExitCode = 64;
|
||||
|
||||
class Option {
|
||||
|
@ -199,7 +200,7 @@ class CompileKernelSnapshotCommand extends CompileSubcommandCommand {
|
|||
|
||||
final String sourcePath = args.rest[0];
|
||||
if (!checkFile(sourcePath)) {
|
||||
return -1;
|
||||
return genericErrorExitCode;
|
||||
}
|
||||
|
||||
// Determine output file name.
|
||||
|
@ -215,7 +216,7 @@ class CompileKernelSnapshotCommand extends CompileSubcommandCommand {
|
|||
|
||||
if (!checkFileWriteable(outputFile)) {
|
||||
log.stderr('Unable to open file $outputFile for writing snapshot.');
|
||||
return -1;
|
||||
return genericErrorExitCode;
|
||||
}
|
||||
|
||||
final bool soundNullSafety = args['sound-null-safety'];
|
||||
|
@ -311,7 +312,7 @@ class CompileJitSnapshotCommand extends CompileSubcommandCommand {
|
|||
|
||||
final String sourcePath = args.rest[0];
|
||||
if (!checkFile(sourcePath)) {
|
||||
return -1;
|
||||
return genericErrorExitCode;
|
||||
}
|
||||
|
||||
// Determine output file name.
|
||||
|
@ -325,7 +326,7 @@ class CompileJitSnapshotCommand extends CompileSubcommandCommand {
|
|||
|
||||
if (!checkFileWriteable(outputFile)) {
|
||||
log.stderr('Unable to open file $outputFile for writing snapshot.');
|
||||
return -1;
|
||||
return genericErrorExitCode;
|
||||
}
|
||||
|
||||
final enabledExperiments = args.enabledExperiments;
|
||||
|
@ -461,7 +462,7 @@ Remove debugging information from the output and save it separately to the speci
|
|||
}
|
||||
final String sourcePath = args.rest[0];
|
||||
if (!checkFile(sourcePath)) {
|
||||
return -1;
|
||||
return genericErrorExitCode;
|
||||
}
|
||||
|
||||
if (!args['sound-null-safety'] && !shouldAllowNoSoundNullSafety()) {
|
||||
|
@ -697,7 +698,7 @@ class CompileWasmCommand extends CompileSubcommandCommand {
|
|||
}
|
||||
final String sourcePath = args.rest[0];
|
||||
if (!checkFile(sourcePath)) {
|
||||
return -1;
|
||||
return genericErrorExitCode;
|
||||
}
|
||||
|
||||
// Determine output file name.
|
||||
|
|
Loading…
Reference in a new issue