on master help sign in
fix executor and test output
commitf8c53ebb5c99c65c93b9b1bc51df7a56675a5380 authorAlex Gryzlov <skyrodent@gmail.com> dateWed 10 Jul 2019, 17:25 (7 years ago) parentf66e8a9
2 files changed+6−2
src/Idris/Core/Execute.hs+5−2 test/ffi013/expected+1
src/Idris/Core/Execute.hs+5−2
@@ -390,8 +390,11 @@ execForeign env ctxt arity ty fn xs onfail
390390 ". Are all cases covered?"
391391 | Just (FFun "fileRemove" [(_,fileStr)] _) <- foreignFromTT arity ty fn xs
392392 = case fileStr of
393− EConstant (Str f) -> do execIO $ removeFile f
394− execApp env ctxt ioUnit (drop arity xs)
393+ EConstant (Str f) -> do res <- execIO $ catch (do removeFile f
394+ return $ ioWrap $ EConstant $ I 0)
395+ (\e -> do writeIORef fileError $ mapError e
396+ return $ ioWrap $ EConstant $ I (-1))
397+ execApp env ctxt res (drop arity xs)
395398 _ -> execFail . Msg $
396399 "The argument to fileRemove should be a constant string, but it was " ++
397400 show fileStr ++
test/ffi013/expected+1
@@ -1 +1,2 @@
11success
2+success