on master help sign in
fix executor and test output
f8c53ebAlex Gryzlov
src/Idris/Core/Execute.hs+5−2
@@ -390,8 +390,11 @@ execForeign env ctxt arity ty fn xs onfail
390 ". Are all cases covered?"
390 ". Are all cases covered?"
391 | Just (FFun "fileRemove" [(_,fileStr)] _) <- foreignFromTT arity ty fn xs
391 | Just (FFun "fileRemove" [(_,fileStr)] _) <- foreignFromTT arity ty fn xs
392 = case fileStr of
392 = case fileStr of
393− EConstant (Str f) -> do execIO $ removeFile f
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))
394− execApp env ctxt ioUnit (drop arity xs)
397+ execApp env ctxt res (drop arity xs)
395 _ -> execFail . Msg $
398 _ -> execFail . Msg $
396 "The argument to fileRemove should be a constant string, but it was " ++
399 "The argument to fileRemove should be a constant string, but it was " ++
397 show fileStr ++
400 show fileStr ++
test/ffi013/expected+1
@@ -1 +1,2 @@
1success
1success
2+success