Comparing version 0.3.0 to 0.3.1
@@ -14,2 +14,3 @@ import { ChildProcess, SpawnOptions } from 'node:child_process'; | ||
stdout: string; | ||
exitCode: number | undefined; | ||
} | ||
@@ -16,0 +17,0 @@ interface PipeOptions extends Options { |
@@ -77,3 +77,3 @@ import { createRequire as __tinyexec_cr } from "node:module";const require = __tinyexec_cr(import.meta.url); | ||
function Kt(t, e) { | ||
var n = t.mode, r = t.uid, s = t.gid, o = e.uid !== void 0 ? e.uid : process.getuid && process.getuid(), i = e.gid !== void 0 ? e.gid : process.getgid && process.getgid(), u = parseInt("100", 8), c = parseInt("010", 8), a = parseInt("001", 8), f = u | c, p = n & a || n & c && s === i || n & u && r === o || n & f && o === 0; | ||
var n = t.mode, r = t.uid, s = t.gid, o = e.uid !== void 0 ? e.uid : process.getuid && process.getuid(), i = e.gid !== void 0 ? e.gid : process.getgid && process.getgid(), a = parseInt("100", 8), c = parseInt("010", 8), u = parseInt("001", 8), f = a | c, p = n & u || n & c && s === i || n & a && r === o || n & f && o === 0; | ||
return p; | ||
@@ -132,21 +132,21 @@ } | ||
typeof e == "function" && (n = e, e = {}), e || (e = {}); | ||
let { pathEnv: r, pathExt: s, pathExtExe: o } = Q(t, e), i = [], u = (a) => new Promise((f, p) => { | ||
if (a === r.length) | ||
let { pathEnv: r, pathExt: s, pathExtExe: o } = Q(t, e), i = [], a = (u) => new Promise((f, p) => { | ||
if (u === r.length) | ||
return e.all && i.length ? f(i) : p(J(t)); | ||
let d = r[a], w = /^".*"$/.test(d) ? d.slice(1, -1) : d, m = Y.join(w, t), b = !w && /^\.[\\\/]/.test(t) ? t.slice(0, 2) + m : m; | ||
f(c(b, a, 0)); | ||
}), c = (a, f, p) => new Promise((d, w) => { | ||
let d = r[u], w = /^".*"$/.test(d) ? d.slice(1, -1) : d, m = Y.join(w, t), b = !w && /^\.[\\\/]/.test(t) ? t.slice(0, 2) + m : m; | ||
f(c(b, u, 0)); | ||
}), c = (u, f, p) => new Promise((d, w) => { | ||
if (p === s.length) | ||
return d(u(f + 1)); | ||
return d(a(f + 1)); | ||
let m = s[p]; | ||
V(a + m, { pathExt: o }, (b, Ot) => { | ||
V(u + m, { pathExt: o }, (b, Ot) => { | ||
if (!b && Ot) | ||
if (e.all) | ||
i.push(a + m); | ||
i.push(u + m); | ||
else | ||
return d(a + m); | ||
return d(c(a, f, p + 1)); | ||
return d(u + m); | ||
return d(c(u, f, p + 1)); | ||
}); | ||
}); | ||
return n ? u(0).then((a) => n(null, a), n) : u(0); | ||
return n ? a(0).then((u) => n(null, u), n) : a(0); | ||
}, Xt = (t, e) => { | ||
@@ -156,3 +156,3 @@ e = e || {}; | ||
for (let i = 0; i < n.length; i++) { | ||
let u = n[i], c = /^".*"$/.test(u) ? u.slice(1, -1) : u, a = Y.join(c, t), f = !c && /^\.[\\\/]/.test(t) ? t.slice(0, 2) + a : a; | ||
let a = n[i], c = /^".*"$/.test(a) ? a.slice(1, -1) : a, u = Y.join(c, t), f = !c && /^\.[\\\/]/.test(t) ? t.slice(0, 2) + u : u; | ||
for (let p = 0; p < r.length; p++) { | ||
@@ -221,19 +221,19 @@ let d = f + r[p]; | ||
// node_modules/cross-spawn/lib/util/escape.js | ||
var at = l((qe, C) => { | ||
var ut = l((qe, P) => { | ||
"use strict"; | ||
var P = /([()\][%!^"`<>&|;, *?])/g; | ||
var C = /([()\][%!^"`<>&|;, *?])/g; | ||
function Vt(t) { | ||
return t = t.replace(P, "^$1"), t; | ||
return t = t.replace(C, "^$1"), t; | ||
} | ||
function Jt(t, e) { | ||
return t = `${t}`, t = t.replace(/(\\*)"/g, '$1$1\\"'), t = t.replace(/(\\*)$/, "$1$1"), t = `"${t}"`, t = t.replace(P, "^$1"), e && (t = t.replace(P, "^$1")), t; | ||
return t = `${t}`, t = t.replace(/(\\*)"/g, '$1$1\\"'), t = t.replace(/(\\*)$/, "$1$1"), t = `"${t}"`, t = t.replace(C, "^$1"), e && (t = t.replace(C, "^$1")), t; | ||
} | ||
C.exports.command = Vt; | ||
C.exports.argument = Jt; | ||
P.exports.command = Vt; | ||
P.exports.argument = Jt; | ||
}); | ||
// node_modules/shebang-regex/index.js | ||
var lt = l((Ie, ut) => { | ||
var lt = l((Ie, at) => { | ||
"use strict"; | ||
ut.exports = /^#!(.*)/; | ||
at.exports = /^#!(.*)/; | ||
}); | ||
@@ -272,3 +272,3 @@ | ||
"use strict"; | ||
var ee = h("path"), mt = ct(), gt = at(), ne = ht(), re = process.platform === "win32", se = /\.(?:com|exe)$/i, oe = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i; | ||
var ee = h("path"), mt = ct(), gt = ut(), ne = ht(), re = process.platform === "win32", se = /\.(?:com|exe)$/i, oe = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i; | ||
function ie(t) { | ||
@@ -291,3 +291,3 @@ t.file = mt(t); | ||
} | ||
function ae(t, e, n) { | ||
function ue(t, e, n) { | ||
e && !Array.isArray(e) && (n = e, e = null), e = e ? e.slice(0) : [], n = Object.assign({}, n); | ||
@@ -306,3 +306,3 @@ let r = { | ||
} | ||
Et.exports = ae; | ||
Et.exports = ue; | ||
}); | ||
@@ -323,3 +323,3 @@ | ||
} | ||
function ue(t, e) { | ||
function ae(t, e) { | ||
if (!S) | ||
@@ -344,3 +344,3 @@ return; | ||
vt.exports = { | ||
hookChildProcess: ue, | ||
hookChildProcess: ae, | ||
verifyENOENT: xt, | ||
@@ -353,3 +353,3 @@ verifyENOENTSync: le, | ||
// node_modules/cross-spawn/index.js | ||
var Pt = l((He, E) => { | ||
var Ct = l((He, E) => { | ||
"use strict"; | ||
@@ -420,3 +420,3 @@ var yt = h("child_process"), T = wt(), A = bt(); | ||
// src/main.ts | ||
var Ct = Nt(Pt(), 1); | ||
var Pt = Nt(Ct(), 1); | ||
import me from "readline"; | ||
@@ -537,3 +537,4 @@ | ||
stderr: n, | ||
stdout: r | ||
stdout: r, | ||
exitCode: this.exitCode | ||
}; | ||
@@ -555,10 +556,10 @@ if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) | ||
this._resetState(), n.timeout !== void 0 && s.push(AbortSignal.timeout(n.timeout)), n.signal !== void 0 && s.push(n.signal), n.persist === !0 && (r.detached = !0), s.length > 0 && (r.signal = xe(s)), r.env = I(e, r.env); | ||
let { command: o, args: i } = we(this._command, this._args), u = (0, Ct._parse)(o, i, r), c = de( | ||
u.command, | ||
u.args, | ||
u.options | ||
let { command: o, args: i } = we(this._command, this._args), a = (0, Pt._parse)(o, i, r), c = de( | ||
a.command, | ||
a.args, | ||
a.options | ||
); | ||
if (c.stderr && (this._streamErr = c.stderr), c.stdout && (this._streamOut = c.stdout), this._process = c, c.once("error", this._onError), c.once("close", this._onClose), n.stdin !== void 0 && c.stdin && n.stdin.process) { | ||
let { stdout: a } = n.stdin.process; | ||
a && a.pipe(c.stdin); | ||
let { stdout: u } = n.stdin.process; | ||
u && u.pipe(c.stdin); | ||
} | ||
@@ -565,0 +566,0 @@ } |
{ | ||
"name": "tinyexec", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "A minimal library for executing processes in Node", |
@@ -25,2 +25,3 @@ # tinyexec 📟 | ||
// result.stderr - the stderr as a string | ||
// result.exitCode - the process exit code as a number | ||
``` | ||
@@ -33,5 +34,5 @@ | ||
const result = x('ls', ['-l']); | ||
const proc = x('ls', ['-l']); | ||
for await (const line of result) { | ||
for await (const line of proc) { | ||
// line will be from stderr/stdout in the order you'd see it in a term | ||
@@ -38,0 +39,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
45566
1182
240