Skip to content

Commit 7a17d6d

Browse files
RoyLinRoyLin
authored andcommitted
fix(test): make bash env test cross-platform
1 parent cab9a0a commit 7a17d6d

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

core/src/tools/builtin/bash.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -266,12 +266,13 @@ mod tests {
266266
ToolContext::new(temp.path().to_path_buf()).with_command_env(std::sync::Arc::new(
267267
HashMap::from([("A3S_TEST_ENV".to_string(), "visible".to_string())]),
268268
));
269+
#[cfg(windows)]
270+
let command = "echo|set /p=%A3S_TEST_ENV%";
271+
#[cfg(not(windows))]
272+
let command = "printf '%s' \"$A3S_TEST_ENV\"";
269273

270274
let result = tool
271-
.execute(
272-
&serde_json::json!({"command": "printf '%s' \"$A3S_TEST_ENV\""}),
273-
&ctx,
274-
)
275+
.execute(&serde_json::json!({ "command": command }), &ctx)
275276
.await
276277
.unwrap();
277278

0 commit comments

Comments
 (0)