Commit 9ba60786 authored by Todd Volkert's avatar Todd Volkert Committed by GitHub

Update to package:process v1.0.1 (#7607)

parent a3a70c6b
......@@ -62,8 +62,7 @@ class AndroidDevice extends Device {
// We pass an encoding of LATIN1 so that we don't try and interpret the
// `adb shell getprop` result as UTF8.
ProcessResult result = processManager.runSync(
propCommand.first,
propCommand.sublist(1),
propCommand,
stdoutEncoding: LATIN1
);
if (result.exitCode == 0) {
......
......@@ -71,7 +71,7 @@ class AndroidWorkflow extends DoctorValidator implements Workflow {
try {
printTrace('java -version');
ProcessResult result = processManager.runSync('java', <String>['-version']);
ProcessResult result = processManager.runSync(<String>['java', '-version']);
if (result.exitCode == 0) {
javaVersion = result.stderr;
List<String> versionLines = javaVersion.split('\n');
......
......@@ -51,14 +51,14 @@ class _PosixUtils extends OperatingSystemUtils {
@override
ProcessResult makeExecutable(File file) {
return processManager.runSync('chmod', <String>['a+x', file.path]);
return processManager.runSync(<String>['chmod', 'a+x', file.path]);
}
/// Return the path to the given executable, or `null` if `which` was not able
/// to locate the binary.
@override
File which(String execName) {
ProcessResult result = processManager.runSync('which', <String>[execName]);
ProcessResult result = processManager.runSync(<String>['which', execName]);
if (result.exitCode != 0)
return null;
String path = result.stdout.trim().split('\n').first.trim();
......@@ -89,7 +89,7 @@ class _WindowsUtils extends OperatingSystemUtils {
@override
File which(String execName) {
ProcessResult result = processManager.runSync('where', <String>[execName]);
ProcessResult result = processManager.runSync(<String>['where', execName]);
if (result.exitCode != 0)
return null;
return fs.file(result.stdout.trim().split('\n').first.trim());
......
......@@ -54,11 +54,8 @@ Future<Process> runCommand(List<String> cmd, {
Map<String, String> environment
}) async {
_traceCommand(cmd, workingDirectory: workingDirectory);
String executable = cmd[0];
List<String> arguments = cmd.length > 1 ? cmd.sublist(1) : <String>[];
Process process = await processManager.start(
executable,
arguments,
cmd,
workingDirectory: workingDirectory,
environment: _environment(allowReentrantFlutter, environment)
);
......@@ -127,8 +124,8 @@ Future<Null> runAndKill(List<String> cmd, Duration timeout) {
Future<Process> runDetached(List<String> cmd) {
_traceCommand(cmd);
Future<Process> proc = processManager.start(
cmd[0], cmd.getRange(1, cmd.length).toList(),
mode: ProcessStartMode.DETACHED
cmd,
mode: ProcessStartMode.DETACHED,
);
return proc;
}
......@@ -139,10 +136,9 @@ Future<RunResult> runAsync(List<String> cmd, {
}) async {
_traceCommand(cmd, workingDirectory: workingDirectory);
ProcessResult results = await processManager.run(
cmd[0],
cmd.getRange(1, cmd.length).toList(),
cmd,
workingDirectory: workingDirectory,
environment: _environment(allowReentrantFlutter)
environment: _environment(allowReentrantFlutter),
);
RunResult runResults = new RunResult(results);
printTrace(runResults.toString());
......@@ -152,7 +148,7 @@ Future<RunResult> runAsync(List<String> cmd, {
bool exitsHappy(List<String> cli) {
_traceCommand(cli);
try {
return processManager.runSync(cli.first, cli.sublist(1)).exitCode == 0;
return processManager.runSync(cli).exitCode == 0;
} catch (error) {
return false;
}
......@@ -216,10 +212,9 @@ String _runWithLoggingSync(List<String> cmd, {
}) {
_traceCommand(cmd, workingDirectory: workingDirectory);
ProcessResult results = processManager.runSync(
cmd[0],
cmd.getRange(1, cmd.length).toList(),
cmd,
workingDirectory: workingDirectory,
environment: _environment(allowReentrantFlutter)
environment: _environment(allowReentrantFlutter),
);
printTrace('Exit code ${results.exitCode} from: ${cmd.join(' ')}');
......
......@@ -158,10 +158,15 @@ class AnalysisServer {
Future<Null> start() async {
String snapshot = path.join(sdk, 'bin/snapshots/analysis_server.dart.snapshot');
List<String> args = <String>[snapshot, '--sdk', sdk];
printTrace('dart ${args.join(' ')}');
_process = await processManager.start(path.join(dartSdkPath, 'bin', 'dart'), args);
List<String> command = <String>[
path.join(dartSdkPath, 'bin', 'dart'),
snapshot,
'--sdk',
sdk,
];
printTrace('dart ${command.skip(1).join(' ')}');
_process = await processManager.start(command);
_process.exitCode.whenComplete(() => _process = null);
Stream<String> errorStream = _process.stderr.transform(UTF8.decoder).transform(const LineSplitter());
......
......@@ -139,7 +139,8 @@ class TestCommand extends FlutterCommand {
Directory tempDir = fs.systemTempDirectory.createTempSync('flutter_tools');
try {
File sourceFile = coverageFile.copySync(path.join(tempDir.path, 'lcov.source.info'));
ProcessResult result = processManager.runSync('lcov', <String>[
ProcessResult result = processManager.runSync(<String>[
'lcov',
'--add-tracefile', baseCoverageData,
'--add-tracefile', sourceFile.path,
'--output-file', coverageFile.path,
......
......@@ -41,7 +41,7 @@ class XCode {
} else {
try {
printTrace('xcrun clang');
ProcessResult result = processManager.runSync('/usr/bin/xcrun', <String>['clang']);
ProcessResult result = processManager.runSync(<String>['/usr/bin/xcrun', 'clang']);
if (result.stdout != null && result.stdout.contains('license'))
_eulaSigned = false;
......
......@@ -190,9 +190,9 @@ class SimControl {
// },
// "pairs": { ... },
List<String> args = <String>['simctl', 'list', '--json', section.name];
printTrace('$_xcrunPath ${args.join(' ')}');
ProcessResult results = processManager.runSync(_xcrunPath, args);
List<String> command = <String>[_xcrunPath, 'simctl', 'list', '--json', section.name];
printTrace(command.join(' '));
ProcessResult results = processManager.runSync(command);
if (results.exitCode != 0) {
printError('Error executing simctl: ${results.exitCode}\n${results.stderr}');
return <String, Map<String, dynamic>>{};
......
......@@ -427,7 +427,7 @@ void main() {
}) {
assert(executable != null); // Please provide the path to the shell in the SKY_SHELL environment variable.
assert(!startPaused || enableObservatory);
List<String> arguments = <String>[];
List<String> command = <String>[executable];
if (enableObservatory) {
// Some systems drive the _FlutterPlatform class in an unusual way, where
// only one test file is processed at a time, and the operating
......@@ -439,27 +439,27 @@ void main() {
// I mention this only so that you won't be tempted, as I was, to apply
// the obvious simplification to this code and remove this entire feature.
if (observatoryPort != null)
arguments.add('--observatory-port=$observatoryPort');
command.add('--observatory-port=$observatoryPort');
if (diagnosticPort != null)
arguments.add('--diagnostic-port=$diagnosticPort');
command.add('--diagnostic-port=$diagnosticPort');
if (startPaused)
arguments.add('--start-paused');
command.add('--start-paused');
} else {
arguments.addAll(<String>['--disable-observatory', '--disable-diagnostic']);
command.addAll(<String>['--disable-observatory', '--disable-diagnostic']);
}
arguments.addAll(<String>[
command.addAll(<String>[
'--enable-dart-profiling',
'--non-interactive',
'--enable-checked-mode',
'--packages=$packages',
testPath,
]);
printTrace('$executable ${arguments.join(' ')}');
printTrace(command.join(' '));
Map<String, String> environment = <String, String>{
'FLUTTER_TEST': 'true',
'FONTCONFIG_FILE': _fontConfigFile.path,
};
return processManager.start(executable, arguments, environment: environment);
return processManager.start(command, environment: environment);
}
String get observatoryPortString => 'Observatory listening on http://${_kHost.address}:';
......
......@@ -74,7 +74,7 @@ class FlutterVersion {
/// A date String describing the last framework commit.
static String get frameworkCommitDate {
return _runSync('git', <String>['log', '-n', '1', '--pretty=format:%ad', '--date=format:%Y-%m-%d %H:%M:%S'], Cache.flutterRoot);
return _runSync(<String>['git', 'log', '-n', '1', '--pretty=format:%ad', '--date=format:%Y-%m-%d %H:%M:%S'], Cache.flutterRoot);
}
static FlutterVersion getVersion([String flutterRoot]) {
......@@ -85,10 +85,10 @@ class FlutterVersion {
static String getVersionString({ bool whitelistBranchName: false }) {
final String cwd = Cache.flutterRoot;
String commit = _shortGitRevision(_runSync('git', <String>['rev-parse', 'HEAD'], cwd));
String commit = _shortGitRevision(_runSync(<String>['git', 'rev-parse', 'HEAD'], cwd));
commit = commit.isEmpty ? 'unknown' : commit;
String branch = _runSync('git', <String>['rev-parse', '--abbrev-ref', 'HEAD'], cwd);
String branch = _runSync(<String>['git', 'rev-parse', '--abbrev-ref', 'HEAD'], cwd);
branch = branch == 'HEAD' ? 'master' : branch;
if (whitelistBranchName || branch.isEmpty) {
......@@ -101,8 +101,8 @@ class FlutterVersion {
}
}
String _runSync(String executable, List<String> arguments, String cwd) {
ProcessResult results = processManager.runSync(executable, arguments, workingDirectory: cwd);
String _runSync(List<String> command, String cwd) {
ProcessResult results = processManager.runSync(command, workingDirectory: cwd);
return results.exitCode == 0 ? results.stdout.trim() : '';
}
......
......@@ -17,12 +17,12 @@ dependencies:
intl: '>=0.14.0 <0.15.0'
json_rpc_2: ^2.0.0
json_schema: 1.0.6
linter: 0.1.30-alpha.1
linter: 0.1.30-alpha.1
meta: ^1.0.4
mustache: ^0.2.5
package_config: '>=0.1.5 <2.0.0'
path: ^1.4.0
process: 1.0.0
process: 1.0.1
pub_semver: ^1.0.0
stack_trace: ^1.4.0
usage: ^2.2.1
......
......@@ -29,5 +29,5 @@ void updateFileModificationTime(String path,
'${modificationTime.minute.toString().padLeft(2, "0")}'
'.${modificationTime.second.toString().padLeft(2, "0")}';
ProcessManager processManager = context[ProcessManager];
processManager.runSync('touch', <String>['-t', argument, path]);
processManager.runSync(<String>['touch', '-t', argument, path]);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment