swytchcode 2.2.1 → 2.2.3
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 +2 -2
- package/bin/swytchcode.js +22 -2
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -67,5 +67,5 @@ All runtimes resolve the `swytchcode` binary from `$PATH` by default. Set `SWYTC
|
|
|
67
67
|
|
|
68
68
|
- [swytchcode.com](https://swytchcode.com)
|
|
69
69
|
- [Documentation](https://docs.swytchcode.com)
|
|
70
|
-
- [Wiki](https://gitlab.com/swytchcode/cli/-/wikis/home)
|
|
71
|
-
- [Releases](https://gitlab.com/swytchcode/cli/-/releases)
|
|
70
|
+
- [Wiki](https://gitlab.com/swytchcode/swytchcode-cli/-/wikis/home)
|
|
71
|
+
- [Releases](https://gitlab.com/swytchcode/swytchcode-cli/-/releases)
|
package/bin/swytchcode.js
CHANGED
|
@@ -2,11 +2,31 @@
|
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
4
|
const { spawnSync } = require('child_process');
|
|
5
|
+
const fs = require('fs');
|
|
6
|
+
|
|
7
|
+
// When stdin is piped (not a TTY), read it fully and re-pipe it explicitly to the
|
|
8
|
+
// child. Blindly inheriting a piped stdin fd can leave the Go binary with an
|
|
9
|
+
// already-EOF pipe, causing its HTTP context to cancel mid-response.
|
|
10
|
+
function spawnBin(binPath, args) {
|
|
11
|
+
if (process.stdin.isTTY) {
|
|
12
|
+
return spawnSync(binPath, args, { stdio: 'inherit' });
|
|
13
|
+
}
|
|
14
|
+
let stdinData;
|
|
15
|
+
try {
|
|
16
|
+
stdinData = fs.readFileSync(0); // fd 0 = stdin
|
|
17
|
+
} catch (_) {
|
|
18
|
+
stdinData = Buffer.alloc(0);
|
|
19
|
+
}
|
|
20
|
+
return spawnSync(binPath, args, {
|
|
21
|
+
stdio: ['pipe', 'inherit', 'inherit'],
|
|
22
|
+
input: stdinData,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
5
25
|
|
|
6
26
|
// Explicit override: set SWYTCHCODE_BIN=/path/to/binary to bypass platform package resolution.
|
|
7
27
|
const explicitBin = (process.env.SWYTCHCODE_BIN || '').trim();
|
|
8
28
|
if (explicitBin) {
|
|
9
|
-
const result =
|
|
29
|
+
const result = spawnBin(explicitBin, process.argv.slice(2));
|
|
10
30
|
if (result.error) {
|
|
11
31
|
process.stderr.write(`swytchcode: failed to launch SWYTCHCODE_BIN="${explicitBin}": ${result.error.message}\n`);
|
|
12
32
|
process.exit(1);
|
|
@@ -51,7 +71,7 @@ try {
|
|
|
51
71
|
process.exit(1);
|
|
52
72
|
}
|
|
53
73
|
|
|
54
|
-
const result =
|
|
74
|
+
const result = spawnBin(binPath, process.argv.slice(2));
|
|
55
75
|
|
|
56
76
|
if (result.error) {
|
|
57
77
|
process.stderr.write(`swytchcode: failed to launch binary: ${result.error.message}\n`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "swytchcode",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"description": "Execution layer for API integrations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"api",
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"README.md"
|
|
24
24
|
],
|
|
25
25
|
"optionalDependencies": {
|
|
26
|
-
"swytchcode-cli-darwin-arm64": "2.2.
|
|
27
|
-
"swytchcode-cli-darwin-x64": "2.2.
|
|
28
|
-
"swytchcode-cli-linux-arm64": "2.2.
|
|
29
|
-
"swytchcode-cli-linux-x64": "2.2.
|
|
30
|
-
"swytchcode-cli-win32-arm64": "2.2.
|
|
31
|
-
"swytchcode-cli-win32-x64": "2.2.
|
|
26
|
+
"swytchcode-cli-darwin-arm64": "2.2.3",
|
|
27
|
+
"swytchcode-cli-darwin-x64": "2.2.3",
|
|
28
|
+
"swytchcode-cli-linux-arm64": "2.2.3",
|
|
29
|
+
"swytchcode-cli-linux-x64": "2.2.3",
|
|
30
|
+
"swytchcode-cli-win32-arm64": "2.2.3",
|
|
31
|
+
"swytchcode-cli-win32-x64": "2.2.3"
|
|
32
32
|
}
|
|
33
33
|
}
|