Skip to content

Commit

Permalink
Correct parsing of /etc/shells
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryAstafyev committed Oct 18, 2023
1 parent 65dc8d5 commit 337693d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/profiles/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,18 @@ pub(crate) fn get() -> Result<Vec<Profile>, Error> {
for shell in read_to_string(shells_file_path)
.map_err(Error::Io)?
.split('\n')
.filter(|s| !s.starts_with('#') && !s.is_empty())
{
let path = Path::new(shell);
let profile = match Profile::new(&path.to_path_buf(), vec!["-c"], None) {
let profile = match Profile::new(
&path.to_path_buf(),
if path.ends_with("tcsh") || path.ends_with("csh") {
vec!["-c"]
} else {
vec!["-l", "-c"]
},
None,
) {
Ok(profile) => profile,
Err(err) => {
log::warn!("Cannot get envvars for {shell}: {err}");
Expand Down

0 comments on commit 337693d

Please sign in to comment.