diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-04-21 21:23:05 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-04-21 21:23:05 -0400 |
commit | 194272f2f40a3d2aeee930d502379a7526e0d28d (patch) | |
tree | 3cace14f5249a23d52919844c183630f75826f0f /Role/User.hs | |
parent | fe3c26650bb1e267cce756831fdb9cde230cafd5 (diff) | |
download | debug-me-194272f2f40a3d2aeee930d502379a7526e0d28d.tar.gz |
improve selection of command to run
Diffstat (limited to 'Role/User.hs')
-rw-r--r-- | Role/User.hs | 8 |
1 files changed, 6 insertions, 2 deletions
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 |