mirror of
https://github.com/IHaskell/IHaskell.git
synced 2025-04-16 19:36:06 +00:00
Fixing the error that deletes half your filesystem if you use modules
This commit is contained in:
parent
7f97d11de9
commit
bae2b0446c
7
Main.hs
7
Main.hs
@ -9,6 +9,7 @@ import Control.Concurrent.Chan
|
||||
import Data.Aeson
|
||||
import Text.Printf
|
||||
import System.Exit (exitSuccess)
|
||||
import System.Directory
|
||||
|
||||
import qualified Data.Map as Map
|
||||
|
||||
@ -57,6 +58,12 @@ main = do
|
||||
kernel :: String -- ^ Filename of profile JSON file.
|
||||
-> IO ()
|
||||
kernel profileSrc = do
|
||||
-- Switch to a temporary directory so that any files we create aren't
|
||||
-- visible. On Unix, this is usually /tmp. If there is no temporary
|
||||
-- directory available, just stay in the current one and ignore the
|
||||
-- raised exception.
|
||||
try (getTemporaryDirectory >>= setCurrentDirectory) :: IO (Either SomeException ())
|
||||
|
||||
-- Parse the profile file.
|
||||
Just profile <- liftM decode . readFile . fpFromText $ pack profileSrc
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user