Skip to content

Commit 2b9bde5

Browse files
t3dotggclaude
andcommitted
test(grok): quote fake CLI paths without JSON.stringify
Co-Authored-By: Claude Fable 5.1 <[email protected]>
1 parent b7f5d8f commit 2b9bde5

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎apps/server/src/provider/Layers/GrokProvider.test.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,9 @@ it.layer(NodeServices.layer)("checkGrokProviderStatus", (it) => {
331331
}),
332332
);
333333

334+
// Single-quotes a path for /bin/sh. Temp dirs and execPath never contain quotes.
335+
const shellQuote = (value: string) => `'${value.replaceAll("'", `'\\''`)}'`;
336+
334337
// A shell stand-in for the Grok CLI: `--version` and `models` print canned text,
335338
// and `agent stdio` execs the mock ACP agent so `initialize` returns model metadata.
336339
const writeFakeGrokCli = (input: { readonly modelsOutput: string; readonly acp: boolean }) =>
@@ -348,9 +351,9 @@ it.layer(NodeServices.layer)("checkGrokProviderStatus", (it) => {
348351
"#!/bin/sh",
349352
'case "$1" in',
350353
' --version) printf "grok 1.0.13\\n"; exit 0;;',
351-
` models) cat ${JSON.stringify(modelsPath)}; exit 0;;`,
354+
` models) cat ${shellQuote(modelsPath)}; exit 0;;`,
352355
input.acp
353-
? ` agent) exec ${JSON.stringify(process.execPath)} ${JSON.stringify(mockAgentPath)};;`
356+
? ` agent) exec ${shellQuote(process.execPath)} ${shellQuote(mockAgentPath)};;`
354357
: " agent) exit 3;;",
355358
"esac",
356359
"exit 1",

0 commit comments

Comments
 (0)