Skip to content

Commit 10b7838

Browse files
committed
fix(ci): avoid login shell side effects in shell command execution
1 parent a8958ca commit 10b7838

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

src/cron/scheduler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ async fn run_job_command_with_timeout(
581581

582582
let mut command = Command::new("/bin/sh");
583583
command
584-
.arg("-lc")
584+
.arg("-c")
585585
.arg(&job.command)
586586
.current_dir(&config.workspace_dir)
587587
.stdin(Stdio::null())

src/service/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,23 +1164,23 @@ mod tests {
11641164
#[cfg(not(target_os = "windows"))]
11651165
#[test]
11661166
fn run_capture_reads_stdout() {
1167-
let out = run_capture(Command::new("/bin/sh").args(["-lc", "echo hello"]))
1167+
let out = run_capture(Command::new("/bin/sh").args(["-c", "echo hello"]))
11681168
.expect("stdout capture should succeed");
11691169
assert_eq!(out.trim(), "hello");
11701170
}
11711171

11721172
#[cfg(not(target_os = "windows"))]
11731173
#[test]
11741174
fn run_capture_falls_back_to_stderr() {
1175-
let out = run_capture(Command::new("/bin/sh").args(["-lc", "echo warn 1>&2"]))
1175+
let out = run_capture(Command::new("/bin/sh").args(["-c", "echo warn 1>&2"]))
11761176
.expect("stderr capture should succeed");
11771177
assert_eq!(out.trim(), "warn");
11781178
}
11791179

11801180
#[cfg(not(target_os = "windows"))]
11811181
#[test]
11821182
fn run_checked_errors_on_non_zero_status() {
1183-
let err = run_checked(Command::new("/bin/sh").args(["-lc", "exit 17"]))
1183+
let err = run_checked(Command::new("/bin/sh").args(["-c", "exit 17"]))
11841184
.expect_err("non-zero exit should error");
11851185
assert!(err.to_string().contains("Command failed"));
11861186
}

0 commit comments

Comments
 (0)