iterate-harness 2.2.2 → 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/lib/bootstrap.js +23 -5
- package/package.json +1 -1
package/lib/bootstrap.js
CHANGED
|
@@ -200,8 +200,20 @@ function pipInstallArgs(target) {
|
|
|
200
200
|
|
|
201
201
|
function packageVersion() {
|
|
202
202
|
const manifestPath = path.resolve(__dirname, "..", "package.json");
|
|
203
|
-
|
|
204
|
-
|
|
203
|
+
try {
|
|
204
|
+
const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
|
205
|
+
if (typeof manifest.version === "string" && manifest.version) {
|
|
206
|
+
return manifest.version;
|
|
207
|
+
}
|
|
208
|
+
} catch (error) {
|
|
209
|
+
// A corrupted/missing manifest must not crash every `ih` invocation with an
|
|
210
|
+
// unhandled exception; fall back to an unknown version so the wrapper can
|
|
211
|
+
// still run the Python harness and surface the real error later if any.
|
|
212
|
+
process.stderr.write(
|
|
213
|
+
`[iterate-harness] warning: cannot read ${manifestPath}: ${error.message}\n`
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
return "0.0.0-unknown";
|
|
205
217
|
}
|
|
206
218
|
|
|
207
219
|
function runtimeHomeDir(env) {
|
|
@@ -518,7 +530,9 @@ async function ensureRuntime(env, options) {
|
|
|
518
530
|
const executable = venvExecutablePaths(venvDir, process.platform);
|
|
519
531
|
const stampPath = path.join(homeDir, STAMP_FILE_NAME);
|
|
520
532
|
|
|
521
|
-
const skipInstall =
|
|
533
|
+
const skipInstall = ["1", "true", "yes", "on"].includes(
|
|
534
|
+
String(environment[SKIP_INSTALL_ENV_VAR] || "").toLowerCase()
|
|
535
|
+
);
|
|
522
536
|
const stampContent = fs.existsSync(stampPath)
|
|
523
537
|
? fs.readFileSync(stampPath, "utf8")
|
|
524
538
|
: "";
|
|
@@ -602,14 +616,18 @@ async function runHarness(args, env) {
|
|
|
602
616
|
child.kill(signal);
|
|
603
617
|
}
|
|
604
618
|
};
|
|
605
|
-
process.on("SIGINT",
|
|
606
|
-
process.on("SIGTERM",
|
|
619
|
+
process.on("SIGINT", forwardSignal);
|
|
620
|
+
process.on("SIGTERM", forwardSignal);
|
|
607
621
|
|
|
608
622
|
child.on("error", (error) => {
|
|
609
623
|
process.stderr.write(`[iterate-harness] failed to launch ih: ${error.message}\n`);
|
|
610
624
|
process.exit(1);
|
|
611
625
|
});
|
|
612
626
|
child.on("close", (code, signal) => {
|
|
627
|
+
// Tear the signal handlers down so repeated runHarness calls in one process
|
|
628
|
+
// never stack duplicate forwarders (would re-send each signal N times).
|
|
629
|
+
process.removeListener("SIGINT", forwardSignal);
|
|
630
|
+
process.removeListener("SIGTERM", forwardSignal);
|
|
613
631
|
if (signal) {
|
|
614
632
|
process.kill(process.pid, signal);
|
|
615
633
|
return;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "iterate-harness",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"description": "npm distribution wrapper for iterate-harness — installs the Python harness (ih CLI) into a managed venv on install and exposes it as a global command",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|