@magic/cli 0.0.45 → 0.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/package.json +2 -2
- package/src/exec.mjs +8 -1
package/README.md
CHANGED
|
@@ -547,6 +547,11 @@ update dependencies
|
|
|
547
547
|
- update dependencies
|
|
548
548
|
- cli.prompt - msg can be an array
|
|
549
549
|
|
|
550
|
-
##### 0.0.46
|
|
550
|
+
##### 0.0.46
|
|
551
|
+
|
|
552
|
+
- cli.exec allows stderrToStdout redirect config option
|
|
553
|
+
- update dependencies
|
|
554
|
+
|
|
555
|
+
##### 0.0.47 - unreleased
|
|
551
556
|
|
|
552
557
|
- ...
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magic/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.46",
|
|
4
4
|
"homepage": "https://magic.github.io/cli",
|
|
5
5
|
"description": "declarative command line interfaces with aliasing, commands and environment sanitization",
|
|
6
6
|
"scripts": {
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@magic-modules/no-spy": "0.0.9",
|
|
45
45
|
"@magic-modules/pre": "0.0.12",
|
|
46
46
|
"@magic-themes/docs": "0.0.15",
|
|
47
|
-
"@magic/core": "0.0.
|
|
47
|
+
"@magic/core": "0.0.153",
|
|
48
48
|
"@magic/format": "0.0.51",
|
|
49
49
|
"@magic/test": "0.2.17"
|
|
50
50
|
},
|
package/src/exec.mjs
CHANGED
|
@@ -6,7 +6,9 @@ const libName = '@magic/cli.exec'
|
|
|
6
6
|
|
|
7
7
|
export const exec = (cmd, options = {}) =>
|
|
8
8
|
new Promise((resolve, reject) => {
|
|
9
|
-
|
|
9
|
+
const { stderrToStdout, ...opts } = options
|
|
10
|
+
|
|
11
|
+
child_process.exec(cmd, opts, (err, stdout, stderr) => {
|
|
10
12
|
if (err) {
|
|
11
13
|
const e = error(err, 'E_EXEC_ERR')
|
|
12
14
|
reject(e)
|
|
@@ -14,6 +16,11 @@ export const exec = (cmd, options = {}) =>
|
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
if (stderr) {
|
|
19
|
+
if (stderrToStdout) {
|
|
20
|
+
resolve(stderr)
|
|
21
|
+
return
|
|
22
|
+
}
|
|
23
|
+
|
|
17
24
|
const e = error(new Error(`${libName}: ${cmd} error: ${stderr}`), 'E_EXEC_STDERR')
|
|
18
25
|
reject(e)
|
|
19
26
|
return
|