From 194272f2f40a3d2aeee930d502379a7526e0d28d Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 21 Apr 2017 21:23:05 -0400 Subject: improve selection of command to run --- Role/User.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'Role/User.hs') diff --git a/Role/User.hs b/Role/User.hs index efbbb24..99a8a1a 100644 --- a/Role/User.hs +++ b/Role/User.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE OverloadedStrings, TupleSections #-} module Role.User where @@ -19,8 +19,10 @@ import System.Exit import qualified Data.ByteString as B import Data.List.NonEmpty (NonEmpty(..), toList) import Data.Monoid +import Data.Maybe import Data.Time.Clock.POSIX import System.IO +import System.Environment run :: UserOpts -> IO ExitCode run os = do @@ -44,7 +46,9 @@ run os = do return exitstatus shellCommand :: UserOpts -> IO (String, [String]) -shellCommand os = return ("dash", []) +shellCommand os = case cmdToRun os of + Just v -> return v + Nothing -> (, []) . fromMaybe "bash" <$> lookupEnv "SHELL" -- | Log of recent Activity, with the most recent first. type Backlog = NonEmpty Log -- cgit v1.2.3