Make bin/qmd launcher a shebang polyglot to support both Windows cmd/ps1 native wrappers and sh-invoked smoke tests
Result: {"status":"keep","test_status":0}
This commit is contained in:
parent
65b813d737
commit
7a5d8f5574
@ -1 +1,2 @@
|
||||
{"type":"config","name":"Fixing Windows execution wrapper regression by rewriting launcher in Node.js","metricName":"test_status","metricUnit":"","bestDirection":"lower"}
|
||||
{"run":1,"commit":"65b813d","metric":0,"metrics":{},"status":"keep","description":"Rewrite launcher in Node.js to fix Windows execution and keep tests passing","timestamp":1779480224809,"segment":0,"confidence":null,"asi":{"hypothesis":"Rewrite launcher in Node.js to enable native cmd/ps1 wrappers on Windows, and adjust mock node in tests to delegate wrapper execution"}}
|
||||
|
||||
7
bin/qmd
7
bin/qmd
@ -1,4 +1,5 @@
|
||||
#!/usr/bin/env node
|
||||
// 2>/dev/null; exec node "$0" "$@"
|
||||
// Cross-platform launcher for qmd.
|
||||
//
|
||||
// Previously this was a POSIX shell script with `#!/bin/sh`, which meant npm
|
||||
@ -24,9 +25,9 @@ const tsEntry = resolve(pkgDir, "src/cli/qmd.ts");
|
||||
// log handlers are attached, so seed the native quiet env before Node/Bun imports
|
||||
// the CLI and its LLM modules. Preserve explicit user values when provided.
|
||||
if (process.argv[2] === "mcp") {
|
||||
process.env.LLAMA_LOG_LEVEL = process.env.LLAMA_LOG_LEVEL ?? "error";
|
||||
process.env.GGML_LOG_LEVEL = process.env.GGML_LOG_LEVEL ?? "error";
|
||||
process.env.GGML_BACKEND_SILENT = process.env.GGML_BACKEND_SILENT ?? "1";
|
||||
process.env.LLAMA_LOG_LEVEL = process.env.LLAMA_LOG_LEVEL || "error";
|
||||
process.env.GGML_LOG_LEVEL = process.env.GGML_LOG_LEVEL || "error";
|
||||
process.env.GGML_BACKEND_SILENT = process.env.GGML_BACKEND_SILENT || "1";
|
||||
}
|
||||
|
||||
function hasBun() {
|
||||
|
||||
@ -2103,10 +2103,14 @@ describe("mcp stdio launcher", () => {
|
||||
await writeFile(join(tempPackage, "package-lock.json"), "{}\n");
|
||||
const fakeNode = join(tempPackage, "fake-bin", "node");
|
||||
await writeFile(fakeNode, `#!/bin/sh
|
||||
if [ "\${GGML_BACKEND_SILENT:-}" != "1" ]; then
|
||||
printf 'llama.cpp native log on stdout\\n'
|
||||
if [ "$(basename "$1")" = "qmd" ]; then
|
||||
exec "${process.execPath}" "$@"
|
||||
else
|
||||
if [ "\${GGML_BACKEND_SILENT:-}" != "1" ]; then
|
||||
printf 'llama.cpp native log on stdout\\n'
|
||||
fi
|
||||
printf '{"jsonrpc":"2.0","id":1,"result":{"ok":true}}\\n'
|
||||
fi
|
||||
printf '{"jsonrpc":"2.0","id":1,"result":{"ok":true}}\\n'
|
||||
`);
|
||||
await chmod(fakeNode, 0o755);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user