Gabriella439 / turtle

Shell programming, Haskell style
BSD 3-Clause "New" or "Revised" License
943 stars 90 forks source link

how to override default shell #372

Open adrian-gierakowski opened 4 years ago

adrian-gierakowski commented 4 years ago

The shell function doesn't seem to respect the $SHELL env var or my current users default shell, it always runs /bin/sh. Fox example, running:

#! /usr/bin/env nix-shell
#! nix-shell -i runghc -p "ghc.withPackages (x: [ x.turtle ])"

{-# LANGUAGE OverloadedStrings #-}

import Turtle

main = do
  shell "echo $SHELL" empty
  shell "dscl . -read ~/ UserShell" empty
  shell "echo $0" empty

prints the following:

/nix/store/7b6xw0kh049s12j2sqbhdv3n6ma11c91-bash-interactive-4.4-p23/bin/bash
UserShell: /usr/local/bin/fish
/bin/sh

Do you know how the underlying System.Process.shell determines which shell to use?

Gabriella439 commented 4 years ago

@adrian-gierakowski: I believe it is hard-coded in Haskell's process library (which is what turtle uses under the hood). So if you think it should respect $SHELL then you might need to open an issue against that package