From 18c887d95ee99b52e8d8b1c0d08278c3f4ea4641 Mon Sep 17 00:00:00 2001 From: Laurence Tratt Date: Mon, 18 Dec 2023 11:42:08 +0000 Subject: [PATCH] Default to `/bin/sh` if `$SHELL` isn't set. 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. --- src/jobrunner.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/jobrunner.rs b/src/jobrunner.rs index f9de6af..3e72cd7 100644 --- a/src/jobrunner.rs +++ b/src/jobrunner.rs @@ -58,7 +58,7 @@ struct JobRunner { impl JobRunner { fn new(snare: Arc) -> Result> { - 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);