Index: sdk/lib/_internal/pub/test/global/binstubs/binstub_runs_executable_test.dart |
diff --git a/sdk/lib/_internal/pub/test/global/binstubs/binstub_runs_executable_test.dart b/sdk/lib/_internal/pub/test/global/binstubs/binstub_runs_executable_test.dart |
index 9abed5ae3f052a22e6925c8a2504ae6e7866b4b6..cc3fbdb9b76168d013a5680ca6176482b1529a76 100644 |
--- a/sdk/lib/_internal/pub/test/global/binstubs/binstub_runs_executable_test.dart |
+++ b/sdk/lib/_internal/pub/test/global/binstubs/binstub_runs_executable_test.dart |
@@ -2,8 +2,11 @@ |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
+import 'dart:io'; |
+ |
import 'package:path/path.dart' as p; |
import 'package:scheduled_test/scheduled_process.dart'; |
+import 'package:scheduled_test/scheduled_test.dart'; |
import '../../descriptor.dart' as d; |
import '../../test_pub.dart'; |
@@ -26,7 +29,8 @@ main() { |
schedulePub(args: ["global", "activate", "foo"]); |
var process = new ScheduledProcess.start( |
- p.join(sandboxDir, cachePath, "bin/foo-script"), ["arg1", "arg2"]); |
+ p.join(sandboxDir, cachePath, "bin/foo-script"), ["arg1", "arg2"], |
+ environment: getEnvironment()); |
process.stdout.expect("ok [arg1, arg2]"); |
process.shouldExit(); |
@@ -49,9 +53,22 @@ main() { |
var process = new ScheduledProcess.start( |
p.join(sandboxDir, cachePath, "bin/foo-script"), ["arg1", "arg2"], |
- environment: getPubTestEnvironment()); |
+ environment: getEnvironment()); |
process.stdout.expect("ok [arg1, arg2]"); |
process.shouldExit(); |
}); |
} |
+ |
+/// The buildbots do not have the Dart SDK (containing "dart" and "pub") on |
+/// their PATH, so we need to spawn the binstub process with a PATH that |
+/// explicitly includes it. |
+getEnvironment() { |
+ var binDir = p.dirname(Platform.executable); |
+ var separator = Platform.operatingSystem == "windows" ? ";" : ":"; |
+ var path = "${Platform.environment["PATH"]}$separator$binDir"; |
+ |
+ var environment = getPubTestEnvironment(); |
+ environment["PATH"] = path; |
+ return environment; |
+} |