mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-27 05:22:50 -06:00
Use the SIO monad in the GF shell
+ The restrictions on arbitrary IO when GF is running in restricted mode is now enforced in the types. + This hopefully also solves an intermittent problem when accessing the GF shell through the web API provided by gf -server. This was visible in the Simple Translation Tool and probably caused by some low-level bug in the GHC IO libraries.
This commit is contained in:
@@ -197,16 +197,6 @@ writeUTF8File fpath content = do
|
||||
readBinaryFile path = hGetContents =<< openBinaryFile path ReadMode
|
||||
writeBinaryFile path s = withBinaryFile path WriteMode (flip hPutStr s)
|
||||
|
||||
-- * Functions to limit acesss to arbitrary IO and system commands
|
||||
restricted io =
|
||||
either (const io) (const $ fail message) =<< try (getEnv "GF_RESTRICTED")
|
||||
where
|
||||
message =
|
||||
"This operation is not allowed when GF is running in restricted mode."
|
||||
|
||||
restrictedSystem = restricted . system
|
||||
|
||||
|
||||
-- Because GHC adds the confusing text "user error" for failures cased by
|
||||
-- calls to fail.
|
||||
ioErrorText e = if isUserError e
|
||||
|
||||
Reference in New Issue
Block a user