Skip to content

Commit

Permalink
Default to /bin/sh if $SHELL isn't set.
Browse files Browse the repository at this point in the history
To my surprise, docker doesn't seem to set this variable by default, but
I don't think I should have been surprised: we're not exactly running
under a shell. Defaulting to `/bin/sh` seems the right thing to do in
such a situation.
  • Loading branch information
ltratt committed Dec 18, 2023
1 parent 1263ece commit 18c887d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/jobrunner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ struct JobRunner {

impl JobRunner {
fn new(snare: Arc<Snare>) -> Result<Self, Box<dyn Error>> {
let shell = env::var("SHELL")?;
let shell = env::var("SHELL").unwrap_or_else(|_| "/bin/sh".to_owned());
let maxjobs = snare.conf.lock().unwrap().maxjobs;
assert!(maxjobs <= (std::usize::MAX - 1) / 2);
let mut running = Vec::with_capacity(maxjobs);
Expand Down

0 comments on commit 18c887d

Please sign in to comment.