@magic/cli 0.0.50 → 0.0.51
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 +5 -1
- package/package.json +1 -1
- package/src/exec.js +3 -4
- package/src/execFile.js +1 -1
- package/types/exec.d.ts +3 -2
- package/types/execFile.d.ts +2 -1
- package/types/index.d.ts +2 -2
package/README.md
CHANGED
package/package.json
CHANGED
package/src/exec.js
CHANGED
|
@@ -7,13 +7,12 @@ const libName = '@magic/cli.exec'
|
|
|
7
7
|
/**
|
|
8
8
|
* Executes a shell command using child_process.exec
|
|
9
9
|
* @param {string} cmd - The shell command to execute.
|
|
10
|
-
* @param {
|
|
11
|
-
* @param {boolean} [options.stderrToStdout=false] - If true, resolves stderr as stdout instead of rejecting.
|
|
10
|
+
* @param {child_process.ExecOptionsWithStringEncoding & { stderrToStdout: boolean }} [options = {}] - Execution options.
|
|
12
11
|
* @returns {Promise<string>} Resolves with stdout or stderr (if stderrToStdout = true), rejects with Error.
|
|
13
12
|
*/
|
|
14
|
-
export const exec = (cmd, options
|
|
13
|
+
export const exec = (cmd, options) =>
|
|
15
14
|
new Promise((resolve, reject) => {
|
|
16
|
-
const { stderrToStdout, ...opts } = options
|
|
15
|
+
const { stderrToStdout = false, ...opts } = options || {}
|
|
17
16
|
|
|
18
17
|
child_process.exec(cmd, opts, (err, stdout, stderr) => {
|
|
19
18
|
if (err) {
|
package/src/execFile.js
CHANGED
|
@@ -8,7 +8,7 @@ const libName = '@magic/cli.execFile'
|
|
|
8
8
|
* Executes a file using child_process.execFile
|
|
9
9
|
* @param {string} p - Path to the executable file.
|
|
10
10
|
* @param {string[]} [args=[]] - Arguments to pass to the executable.
|
|
11
|
-
* @param {
|
|
11
|
+
* @param {child_process.ExecFileOptions} [opts={}] - Execution options.
|
|
12
12
|
* @returns {Promise<string | Buffer>} Resolves with stdout, rejects with Error.
|
|
13
13
|
*/
|
|
14
14
|
export const execFile = (p, args = [], opts = {}) =>
|
package/types/exec.d.ts
CHANGED
package/types/execFile.d.ts
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -12,8 +12,8 @@ export const spawn: (
|
|
|
12
12
|
) => import('child_process').ChildProcess
|
|
13
13
|
export const exec: (
|
|
14
14
|
cmd: string,
|
|
15
|
-
options?: {
|
|
16
|
-
stderrToStdout
|
|
15
|
+
options?: import('child_process').ExecOptionsWithStringEncoding & {
|
|
16
|
+
stderrToStdout: boolean
|
|
17
17
|
},
|
|
18
18
|
) => Promise<string>
|
|
19
19
|
export const prompt: (
|