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

This commit is contained in:
Todd Volkert
2017-01-24 10:09:29 -08:00
committed by GitHub
parent a3a70c6b23
commit 9ba607862e
12 changed files with 43 additions and 43 deletions

View File

@@ -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());

View File

@@ -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(' ')}');