Several subtle IODriver bug fixes
This commit is contained in:
24
src/Main.hs
24
src/Main.hs
@@ -5,7 +5,7 @@ import System.Exit (die)
|
||||
import Server (runServerWithPath)
|
||||
import Eval (evalTricu, evalTricuWithStore, mainResult, result)
|
||||
import FileEval (evaluateFileWithContext, evaluateFileWithStore, compileFile)
|
||||
import IODriver (IOPermissions(..), checkIOSentinel, runIO)
|
||||
import IODriver (IOPermissions(..), runIO)
|
||||
import Parser (parseTricu)
|
||||
import REPL (repl)
|
||||
import Research (T, EvaluatedForm(..), Env, formatT, exportDag)
|
||||
@@ -307,17 +307,17 @@ runEval opts = do
|
||||
finalEnv <- foldM (evaluateFileWithStore mconn) Map.empty files
|
||||
return $ mainResult finalEnv
|
||||
finalT <- if evalIo opts
|
||||
then case checkIOSentinel resultT of
|
||||
Right (1, action) -> do
|
||||
let perms = IOPermissions
|
||||
{ allowRead = evalAllowRead opts
|
||||
, allowWrite = evalAllowWrite opts
|
||||
, allowReadAll = evalUnsafeIo opts || evalAllowReadAll opts
|
||||
, allowWriteAll = evalUnsafeIo opts || evalAllowWriteAll opts
|
||||
}
|
||||
runIO perms action
|
||||
Right (v, _) -> die $ "Unsupported IO ABI version: " ++ show v
|
||||
Left err -> die $ "IO mode requested but " ++ err
|
||||
then do
|
||||
let perms = IOPermissions
|
||||
{ allowRead = evalAllowRead opts
|
||||
, allowWrite = evalAllowWrite opts
|
||||
, allowReadAll = evalUnsafeIo opts || evalAllowReadAll opts
|
||||
, allowWriteAll = evalUnsafeIo opts || evalAllowWriteAll opts
|
||||
}
|
||||
result <- runIO perms resultT
|
||||
case result of
|
||||
Left err -> die $ "IO error: " ++ err
|
||||
Right val -> pure val
|
||||
else return resultT
|
||||
case mconn of
|
||||
Just conn -> close conn
|
||||
|
||||
Reference in New Issue
Block a user