Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(488)

Unified Diff: lib/src/io.dart

Issue 2148413002: Use the command builtin rather than which. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Use runInShell. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/global_packages.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/io.dart
diff --git a/lib/src/io.dart b/lib/src/io.dart
index fd3d5134e9b6e056c02658dcbd5b73bc99dcc657..22ed041893237f74b6d18c522086d5546f42909e 100644
--- a/lib/src/io.dart
+++ b/lib/src/io.dart
@@ -681,15 +681,17 @@ Future store(Stream stream, EventSink sink,
/// [environment] is provided, that will be used to augment (not replace) the
/// the inherited variables.
Future<PubProcessResult> runProcess(String executable, List<String> args,
- {workingDir, Map<String, String> environment}) {
- return _descriptorPool.withResource(() {
- return _doProcess(Process.run, executable, args, workingDir, environment)
- .then((result) {
- var pubResult = new PubProcessResult(
- result.stdout, result.stderr, result.exitCode);
- log.processResult(executable, pubResult);
- return pubResult;
- });
+ {workingDir, Map<String, String> environment, bool runInShell: false}) {
+ return _descriptorPool.withResource(() async {
+ var result = await _doProcess(Process.run, executable, args,
+ workingDir: workingDir,
+ environment: environment,
+ runInShell: runInShell);
+
+ var pubResult = new PubProcessResult(
+ result.stdout, result.stderr, result.exitCode);
+ log.processResult(executable, pubResult);
+ return pubResult;
});
}
@@ -702,22 +704,28 @@ Future<PubProcessResult> runProcess(String executable, List<String> args,
/// [environment] is provided, that will be used to augment (not replace) the
/// the inherited variables.
Future<PubProcess> startProcess(String executable, List<String> args,
- {workingDir, Map<String, String> environment}) {
- return _descriptorPool.request().then((resource) {
- return _doProcess(Process.start, executable, args, workingDir, environment)
- .then((ioProcess) {
- var process = new PubProcess(ioProcess);
- process.exitCode.whenComplete(resource.release);
- return process;
- });
+ {workingDir, Map<String, String> environment, bool runInShell: false}) {
+ return _descriptorPool.request().then((resource) async {
+ var ioProcess = await _doProcess(Process.start, executable, args,
+ workingDir: workingDir,
+ environment: environment,
+ runInShell: runInShell);
+
+ var process = new PubProcess(ioProcess);
+ process.exitCode.whenComplete(resource.release);
+ return process;
});
}
/// Like [runProcess], but synchronous.
PubProcessResult runProcessSync(String executable, List<String> args,
- {String workingDir, Map<String, String> environment}) {
+ {String workingDir, Map<String, String> environment,
+ bool runInShell: false}) {
var result = _doProcess(
- Process.runSync, executable, args, workingDir, environment);
+ Process.runSync, executable, args,
+ workingDir: workingDir,
+ environment: environment,
+ runInShell: runInShell);
var pubResult = new PubProcessResult(
result.stdout, result.stderr, result.exitCode);
log.processResult(executable, pubResult);
@@ -813,7 +821,8 @@ class PubProcess {
/// [fn] should have the same signature as [Process.start], except that the
/// returned value may have any return type.
_doProcess(Function fn, String executable, List<String> args,
- String workingDir, Map<String, String> environment) {
+ {String workingDir, Map<String, String> environment,
+ bool runInShell: false}) {
// TODO(rnystrom): Should dart:io just handle this?
// Spawning a process on Windows will not look for the executable in the
// system path. So, if executable looks like it needs that (i.e. it doesn't
@@ -828,7 +837,8 @@ _doProcess(Function fn, String executable, List<String> args,
return fn(executable, args,
workingDirectory: workingDir,
- environment: environment);
+ environment: environment,
+ runInShell: runInShell);
}
/// Updates [path]'s modification time.
« no previous file with comments | « lib/src/global_packages.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698