-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest-exact-command.ts
More file actions
49 lines (41 loc) Β· 1.51 KB
/
test-exact-command.ts
File metadata and controls
49 lines (41 loc) Β· 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/usr/bin/env bun
import { $ } from "bun";
async function testExact() {
console.log("Testing exact command that parallel would run...\n");
// Set environment variable
process.env.ANTHROPIC_MODEL = "claude-3-5-sonnet-20241022";
// Build args exactly as parallel does
const args = ["--print", "--dangerously-skip-permissions", "hello world in python"];
console.log("Args array:", args);
// Test 1: The way parallel does it
try {
console.log("\nπ Test 1: Using array spread (as parallel does)");
const result = await $`claude ${args}`.text();
console.log("β
Success:", result);
} catch (e: any) {
console.error("β Failed");
console.error("Exit code:", e.exitCode);
console.error("Message:", e.message);
console.error("Stderr:", e.stderr?.toString());
console.error("Stdout:", e.stdout?.toString());
}
// Test 2: Join manually
try {
console.log("\nπ Test 2: Manually joined string");
const cmd = `claude ${args.join(" ")}`;
console.log("Command:", cmd);
const result = await $`${cmd}`.text();
console.log("β
Success:", result);
} catch (e: any) {
console.error("β Failed:", e.message);
}
// Test 3: Individual args
try {
console.log("\nπ Test 3: Individual args");
const result = await $`claude --print --dangerously-skip-permissions "hello world in python"`.text();
console.log("β
Success:", result);
} catch (e: any) {
console.error("β Failed:", e.message);
}
}
testExact().catch(console.error);