File tree Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Expand file tree Collapse file tree 2 files changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -34,14 +34,16 @@ console.log(`Hello from ${$.blue.bold("dzx")}!`);
34
34
const branch = await $ ` git branch --show-current ` ;
35
35
await $ ` dep deploy --branch=${branch } ` ;
36
36
37
+ // Print command output to stdout. Will be reverted to "piped" after all async ops are done.
38
+ $ .stdout = " inherit" ;
37
39
await Promise .all ([
38
40
$ ` deno lint ` ,
39
41
$ ` deno fmt --check ` ,
40
42
$ ` deno test --allow-all ` ,
41
43
]);
42
44
43
45
const name = " foo bar" ;
44
- await $ ` mkdir ./tmp/${name } ` ; // params will be quoted if required: /tmp/'foo bar'
46
+ await $ ` mkdir ./tmp/${name } ` ; // Params will be quoted if required: /tmp/'foo bar'.
45
47
46
48
cd (" tmp/foo bar" );
47
49
console .log (Deno .cwd ()); // ./tmp/foo bar
@@ -234,7 +236,8 @@ script.
234
236
- ** $.verbose:** Enable debugging output (log shell commands and execution
235
237
time).
236
238
- ** $.stdout:** Change stdout mode of `` $`command` `` . Can be ` "inherit" ` ,
237
- ` "piped" ` , ` "null" ` or ` number ` . Default: ` "piped" `
239
+ ` "piped" ` , ` "null" ` or ` number ` . Will be reverted to default after all async
240
+ ops are done. Default: ` "piped" `
238
241
- ** $.throwErrors:** Throw errors instead of calling ` Deno.exit ` .
239
242
- ** $.startTime:** The execution start time in ms.
240
243
- ** $.time:** The time left since execution start (now() - $.startTime).
Original file line number Diff line number Diff line change @@ -2,10 +2,13 @@ import { ProcessError } from "./process_error.ts";
2
2
import { ProcessOutput } from "./process_output.ts" ;
3
3
import { quote } from "./quote.ts" ;
4
4
5
+ let runningProcesses = 0 ;
6
+
5
7
export async function exec (
6
8
pieces : TemplateStringsArray ,
7
9
...args : Array < string | number >
8
10
) : Promise < ProcessOutput > {
11
+ runningProcesses ++ ;
9
12
const cmd = quote ( pieces , ...args ) ;
10
13
11
14
if ( $ . verbose ) {
@@ -28,6 +31,10 @@ export async function exec(
28
31
read ( process . stderr , stderr , combined ) ,
29
32
] ) ;
30
33
34
+ if ( -- runningProcesses === 0 ) {
35
+ $ . stdout = "piped" ;
36
+ }
37
+
31
38
if ( status . success ) {
32
39
return new ProcessOutput ( {
33
40
stdout : stdout . join ( "" ) ,
You can’t perform that action at this time.
0 commit comments