@posthog/core 1.23.4 → 1.24.0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawn-local.d.ts","sourceRoot":"","sources":["../../src/process/spawn-local.ts"],"names":[],"mappings":"AAEA,wBAAsB,UAAU,CAC9B,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE;IACP,GAAG,EAAE,MAAM,CAAC,UAAU,CAAA;IACtB,KAAK,EAAE,SAAS,GAAG,QAAQ,CAAA;IAC3B,GAAG,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"spawn-local.d.ts","sourceRoot":"","sources":["../../src/process/spawn-local.ts"],"names":[],"mappings":"AAEA,wBAAsB,UAAU,CAC9B,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE;IACP,GAAG,EAAE,MAAM,CAAC,UAAU,CAAA;IACtB,KAAK,EAAE,SAAS,GAAG,QAAQ,CAAA;IAC3B,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,GACA,OAAO,CAAC,IAAI,CAAC,CAiCf"}
|
|
@@ -28,13 +28,25 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
28
28
|
});
|
|
29
29
|
const external_cross_spawn_namespaceObject = require("cross-spawn");
|
|
30
30
|
async function spawnLocal(executable, args, options) {
|
|
31
|
+
const stdioOption = void 0 !== options.stdin ? [
|
|
32
|
+
'pipe',
|
|
33
|
+
options.stdio,
|
|
34
|
+
options.stdio
|
|
35
|
+
] : options.stdio;
|
|
31
36
|
const child = (0, external_cross_spawn_namespaceObject.spawn)(executable, [
|
|
32
37
|
...args
|
|
33
38
|
], {
|
|
34
|
-
stdio:
|
|
39
|
+
stdio: stdioOption,
|
|
35
40
|
env: options.env,
|
|
36
41
|
cwd: options.cwd
|
|
37
42
|
});
|
|
43
|
+
if (void 0 !== options.stdin && child.stdin) {
|
|
44
|
+
child.stdin.on('error', (err)=>{
|
|
45
|
+
if ('EPIPE' !== err.code) throw err;
|
|
46
|
+
});
|
|
47
|
+
child.stdin.write(options.stdin);
|
|
48
|
+
child.stdin.end();
|
|
49
|
+
}
|
|
38
50
|
await new Promise((resolve, reject)=>{
|
|
39
51
|
child.on('close', (code)=>{
|
|
40
52
|
if (0 === code) resolve();
|
|
@@ -1,12 +1,24 @@
|
|
|
1
1
|
import { spawn } from "cross-spawn";
|
|
2
2
|
async function spawnLocal(executable, args, options) {
|
|
3
|
+
const stdioOption = void 0 !== options.stdin ? [
|
|
4
|
+
'pipe',
|
|
5
|
+
options.stdio,
|
|
6
|
+
options.stdio
|
|
7
|
+
] : options.stdio;
|
|
3
8
|
const child = spawn(executable, [
|
|
4
9
|
...args
|
|
5
10
|
], {
|
|
6
|
-
stdio:
|
|
11
|
+
stdio: stdioOption,
|
|
7
12
|
env: options.env,
|
|
8
13
|
cwd: options.cwd
|
|
9
14
|
});
|
|
15
|
+
if (void 0 !== options.stdin && child.stdin) {
|
|
16
|
+
child.stdin.on('error', (err)=>{
|
|
17
|
+
if ('EPIPE' !== err.code) throw err;
|
|
18
|
+
});
|
|
19
|
+
child.stdin.write(options.stdin);
|
|
20
|
+
child.stdin.end();
|
|
21
|
+
}
|
|
10
22
|
await new Promise((resolve, reject)=>{
|
|
11
23
|
child.on('close', (code)=>{
|
|
12
24
|
if (0 === code) resolve();
|
package/package.json
CHANGED
|
@@ -7,14 +7,28 @@ export async function spawnLocal(
|
|
|
7
7
|
env: NodeJS.ProcessEnv
|
|
8
8
|
stdio: 'inherit' | 'ignore'
|
|
9
9
|
cwd: string
|
|
10
|
+
stdin?: string
|
|
10
11
|
}
|
|
11
12
|
): Promise<void> {
|
|
13
|
+
const stdioOption = options.stdin !== undefined ? ['pipe' as const, options.stdio, options.stdio] : options.stdio
|
|
14
|
+
|
|
12
15
|
const child = spawn(executable, [...args], {
|
|
13
|
-
stdio:
|
|
16
|
+
stdio: stdioOption,
|
|
14
17
|
env: options.env,
|
|
15
18
|
cwd: options.cwd,
|
|
16
19
|
})
|
|
17
20
|
|
|
21
|
+
if (options.stdin !== undefined && child.stdin) {
|
|
22
|
+
child.stdin.on('error', (err: any) => {
|
|
23
|
+
if (err.code !== 'EPIPE') {
|
|
24
|
+
throw err
|
|
25
|
+
}
|
|
26
|
+
// Swallow EPIPE: child may exit before consuming all stdin
|
|
27
|
+
})
|
|
28
|
+
child.stdin.write(options.stdin)
|
|
29
|
+
child.stdin.end()
|
|
30
|
+
}
|
|
31
|
+
|
|
18
32
|
await new Promise<void>((resolve, reject) => {
|
|
19
33
|
child.on('close', (code) => {
|
|
20
34
|
if (code === 0) {
|