-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Drop back to single process instead of processPipe * Keep output statuses and stderrs, stdouts
- Loading branch information
1 parent
b5b79a5
commit 489ef12
Showing
4 changed files
with
107 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,10 @@ | ||
# Simple High level build and deploy helper utils for dnit | ||
# Utils for Typescript / deno / dnit | ||
|
||
Typescript utils for deno https://deno.land/ & dnit https://deno.land/x/dnit | ||
|
||
## Importing in projects | ||
|
||
Deno imports via HTTP(s) | ||
|
||
There are several URL rewriting tools. | ||
|
||
https://deno.land/x - Adds packages to their list of third party modules | ||
|
||
https://denopkg.com/user/repo@tag/path/to/file - A simple redirect to github raw | ||
Deno imports via HTTP(s). There are several URL rewriting tools to help import: | ||
- https://deno.land/x - Adds packages to their list of third party modules | ||
- https://denopkg.com/user/repo@tag/path/to/file - A simple redirect to github raw | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,69 +1,63 @@ | ||
import { assertEquals } from "./test-deps.ts"; | ||
import { assertEquals, assertThrowsAsync } from "./test-deps.ts"; | ||
|
||
import { processPipe, run } from "./process.ts"; | ||
import { runProcess, run, runConsole } from "./process.ts"; | ||
|
||
Deno.test("Process - piping", async () => { | ||
const str = await processPipe({ | ||
in: "null", | ||
Deno.test("Process - stdin stdout", async () => { | ||
const res = await runProcess({ | ||
in: "piped", | ||
out: "piped", | ||
inp: null, | ||
cmds: [ | ||
{ | ||
cmd: ["echo", "hello world"], | ||
}, | ||
{ | ||
cmd: ["cat"], | ||
}, | ||
{ | ||
cmd: ["cat"], | ||
}, | ||
{ | ||
cmd: ["cat"], | ||
}, | ||
], | ||
err: "inherit", | ||
inp: "hello world", | ||
cmd: ["cat"], | ||
}); | ||
|
||
assertEquals(str.trim(), "hello world"); | ||
}); | ||
assertEquals(res.stdout, "hello world"); | ||
assertEquals(res.status.success, true); | ||
|
||
Deno.test("Process - stdin stdout", async () => { | ||
const str = await processPipe({ | ||
const res2 = await runProcess({ | ||
in: "piped", | ||
out: "piped", | ||
out: "inherit", | ||
err: "piped", | ||
inp: "hello world", | ||
cmds: [ | ||
{ | ||
cmd: ["cat"], | ||
}, | ||
{ | ||
cmd: ["cat"], | ||
}, | ||
], | ||
cmd: ["/bin/sh","-c","cat 1>&2"], | ||
}); | ||
|
||
assertEquals(str, "hello world"); | ||
assertEquals(res2.stderr, "hello world"); | ||
assertEquals(res2.status.success, true); | ||
}); | ||
|
||
Deno.test("Process - inherit", async () => { | ||
const str = await processPipe({ | ||
const res = await runProcess({ | ||
in: "piped", | ||
out: "inherit", | ||
err: "inherit", | ||
inp: "hello world", | ||
cmds: [ | ||
{ | ||
cmd: ["cat"], | ||
}, | ||
{ | ||
cmd: ["cat"], | ||
}, | ||
], | ||
cmd: ["cat"] | ||
}); | ||
|
||
// output went to parent process stdout | ||
assertEquals(str, null); | ||
assertEquals(res.status.success, true); | ||
}); | ||
|
||
Deno.test("Process - runConsole", async () => { | ||
await runConsole(["echo","helloworld"]); | ||
}); | ||
|
||
Deno.test("Process - runConsole throws on failure", async () => { | ||
await assertThrowsAsync( async()=>{ | ||
// the process called "false" that always fails | ||
await runConsole(["false"]); | ||
}); | ||
}); | ||
|
||
Deno.test("Process - run", async () => { | ||
const str = await run(["echo", "hello world"]); | ||
assertEquals(str.trim(), "hello world"); | ||
}); | ||
|
||
Deno.test("Process - run throws on failure", async () => { | ||
await assertThrowsAsync( async()=>{ | ||
// the process called "false" that always fails | ||
await run(["false"]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters