blob: 5543e91f8e174a545fd99cc06778b68bc8df9422 [file] [log] [blame]
// Copyright (c) 2016, 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.md file.
library fasta.run;
import 'dart:async' show
Future;
import 'dart:io' show
stdout;
import 'package:testing/testing.dart' show
StdioProcess;
import 'testing/kernel_chain.dart' show
computeDartVm,
computePatchedSdk;
import 'compiler_command_line.dart' show
CompilerCommandLine;
Future<int> run(Uri uri, CompilerCommandLine cl) async {
Uri sdk = await computePatchedSdk();
Uri dartVm = computeDartVm(sdk);
List<String> arguments = <String>["${uri.toFilePath()}"]
..addAll(cl.arguments.skip(1));
if (cl.verbose) {
print("Running ${dartVm.toFilePath()} ${arguments.join(' ')}");
}
StdioProcess result = await StdioProcess.run(dartVm.toFilePath(), arguments);
stdout.write(result.output);
return result.exitCode;
}