on master help sign in
Return the name of the temp file from :exec in IDESLave
4ffc9b3David Raymond Christiansen
src/Idris/REPL.hs+6−6
@@ -320,8 +320,6 @@ ideslaveProcess fn (HNF t) = process stdout fn (HNF t)
320--ideslaveProcess fn TTShell = process stdout fn TTShell -- need some prove mode!
320--ideslaveProcess fn TTShell = process stdout fn TTShell -- need some prove mode!
321ideslaveProcess fn (TestInline t) = process stdout fn (TestInline t)
321ideslaveProcess fn (TestInline t) = process stdout fn (TestInline t)
322
322
323−--that most likely does not work, since we need to wrap
324−--input/output of the executed binary...
325ideslaveProcess fn Execute = do process stdout fn Execute
323ideslaveProcess fn Execute = do process stdout fn Execute
326 iPrintResult ""
324 iPrintResult ""
327ideslaveProcess fn (Compile codegen f) = do process stdout fn (Compile codegen f)
325ideslaveProcess fn (Compile codegen f) = do process stdout fn (Compile codegen f)
@@ -892,17 +890,19 @@ process h fn (TestInline t)
892 c <- colourise
890 c <- colourise
893 iPrintResult (showTm ist (delab ist tm'))
891 iPrintResult (showTm ist (delab ist tm'))
894process h fn Execute
892process h fn Execute
893+ = do ist <- getIState
895− = do (m, _) <- elabVal toplevel False
894+ (m, _) <- elabVal toplevel False
896 (PApp fc
895 (PApp fc
897 (PRef fc (sUN "run__IO"))
896 (PRef fc (sUN "run__IO"))
898 [pexp $ PRef fc (sNS (sUN "main") ["Main"])])
897 [pexp $ PRef fc (sNS (sUN "main") ["Main"])])
899−-- (PRef (FC "main" 0) (NS (UN "main") ["main"]))
900 (tmpn, tmph) <- runIO tempfile
898 (tmpn, tmph) <- runIO tempfile
901 runIO $ hClose tmph
899 runIO $ hClose tmph
902 t <- codegen
900 t <- codegen
903 compile t tmpn m
901 compile t tmpn m
902+ case idris_outputmode ist of
904− runIO $ system tmpn
903+ RawOutput -> do runIO $ system tmpn
905− return ()
904+ return ()
905+ IdeSlave n -> do runIO . hPutStrLn h $ IdeSlave.convSExp "run-program" tmpn n
906 where fc = fileFC "main"
906 where fc = fileFC "main"
907process h fn (Compile codegen f)
907process h fn (Compile codegen f)
908 = do (m, _) <- elabVal toplevel False
908 = do (m, _) <- elabVal toplevel False