Skip to content

Commit

Permalink
Replace fromJust with fromMaybe (fixes #18)
Browse files Browse the repository at this point in the history
  • Loading branch information
noughtmare committed Jun 28, 2016
1 parent 971e2ec commit 0cd5b6e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Config/Dyre/Options.hs
Expand Up @@ -28,7 +28,7 @@ module Config.Dyre.Options
) where

import Data.List (isPrefixOf)
import Data.Maybe (fromJust)
import Data.Maybe (fromMaybe)
import System.IO.Storage (withStore, putValue, getValue, getDefaultValue)
import System.Environment (getArgs, getProgName, withArgs)
import System.Environment.Executable (getExecutablePath)
Expand Down Expand Up @@ -115,7 +115,7 @@ customOptions otherArgs = do
, case stateFile of
Nothing -> ""
Just sf -> "--dyre-state-persist=" ++ sf
, "--dyre-master-binary=" ++ fromJust masterPath
, "--dyre-master-binary=" ++ fromMaybe (error "'dyre' data-store doesn't exist (in Config.Dyre.Options.customOptions)") masterPath
])
return args

Expand Down
4 changes: 2 additions & 2 deletions Config/Dyre/Relaunch.hs
Expand Up @@ -30,7 +30,7 @@ module Config.Dyre.Relaunch
, restoreBinaryState
) where

import Data.Maybe ( fromMaybe, fromJust )
import Data.Maybe ( fromMaybe )
import System.IO ( writeFile, readFile )
import Data.Binary ( Binary, encodeFile, decodeFile )
import Control.Exception ( try, SomeException )
Expand All @@ -48,7 +48,7 @@ import Config.Dyre.Compat ( customExec, getPIDString )
-- value of 'Nothing', the current value of 'getArgs' will be used.
relaunchMaster :: Maybe [String] -> IO ()
relaunchMaster otherArgs = do
masterPath <- fmap fromJust getMasterBinary
masterPath <- fmap (fromMaybe $ error "'dyre' data-store doesn't exist (in Config.Dyre.Relaunch.relaunchMaster)") getMasterBinary
customExec masterPath otherArgs

-- | Relaunch the master binary, but first preserve the program
Expand Down

0 comments on commit 0cd5b6e

Please sign in to comment.