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