Skip to content

Commit be41826

Browse files
committed
test(bash): use -p instead of -e for PowerShell env tests
1 parent f4077af commit be41826

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

packages/opencode/src/tool/bash.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,6 @@ export const BashTool = Tool.define(
493493
if (!Instance.containsPath(cwd)) scan.dirs.add(cwd)
494494
yield* ask(ctx, scan)
495495

496-
<<<<<<< HEAD
497496
return yield* run(
498497
{
499498
shell,

packages/opencode/test/tool/bash.test.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,10 +1193,12 @@ describe("tool.bash env", () => {
11931193
directory: projectRoot,
11941194
fn: async () => {
11951195
const bash = await initBash()
1196-
const code = `console.log(process.env.TEST_VAR)`
1196+
const expr = `process.env.TEST_VAR`
1197+
const cmd = `${bin} -p ${evalarg(expr)}`
1198+
const command = PS.has(sh()) ? `& ${cmd}` : cmd
11971199
const result = await bash.execute(
11981200
{
1199-
command: `${bin} -e ${evalarg(code)}`,
1201+
command,
12001202
description: "Echo environment variable",
12011203
env: { TEST_VAR: "hello_world" },
12021204
},
@@ -1213,10 +1215,12 @@ describe("tool.bash env", () => {
12131215
directory: projectRoot,
12141216
fn: async () => {
12151217
const bash = await initBash()
1216-
const code = `console.log(process.env.VAR1, process.env.VAR2)`
1218+
const expr = `process.env.VAR1 + " " + process.env.VAR2`
1219+
const cmd = `${bin} -p ${evalarg(expr)}`
1220+
const command = PS.has(sh()) ? `& ${cmd}` : cmd
12171221
const result = await bash.execute(
12181222
{
1219-
command: `${bin} -e ${evalarg(code)}`,
1223+
command,
12201224
description: "Echo multiple environment variables",
12211225
env: { VAR1: "foo", VAR2: "bar" },
12221226
},

0 commit comments

Comments
 (0)