summaryrefslogtreecommitdiff
path: root/js/process_test.ts
diff options
context:
space:
mode:
authorYoshiya Hinosawa <stibium121@gmail.com>2019-02-16 00:37:04 +0900
committerRyan Dahl <ry@tinyclouds.org>2019-02-15 10:37:04 -0500
commit2241049c349443a971ba2558f373d62bbb7d9780 (patch)
treebd25d822e7d869acdda59541783ffcae716ca672 /js/process_test.ts
parent748e456cdb18912e780b69cc90023ef37f4d0c24 (diff)
feat: env option in run api (#1773)
Diffstat (limited to 'js/process_test.ts')
-rw-r--r--js/process_test.ts19
1 files changed, 19 insertions, 0 deletions
diff --git a/js/process_test.ts b/js/process_test.ts
index e629dbe3d..9603fb1c8 100644
--- a/js/process_test.ts
+++ b/js/process_test.ts
@@ -186,3 +186,22 @@ testPerm({ run: true }, async function runOutput() {
assertEqual(s, "hello");
p.close();
});
+
+testPerm({ run: true }, async function runEnv() {
+ const p = run({
+ args: [
+ "python",
+ "-c",
+ "import os, sys; sys.stdout.write(os.environ.get('FOO', '') + os.environ.get('BAR', ''))"
+ ],
+ env: {
+ FOO: "0123",
+ BAR: "4567"
+ },
+ stdout: "piped"
+ });
+ const output = await p.output();
+ const s = new TextDecoder().decode(output);
+ assertEqual(s, "01234567");
+ p.close();
+});