Skip to content
Snippets Groups Projects
Commit baa022e6 authored by chrg's avatar chrg
Browse files

A small fix

parent 15acce32
No related branches found
No related tags found
No related merge requests found
...@@ -28,6 +28,7 @@ import System.Directory ...@@ -28,6 +28,7 @@ import System.Directory
import System.Exit import System.Exit
import System.FilePath import System.FilePath
import System.IO import System.IO
import System.IO.Temp
import System.Process.Typed import System.Process.Typed
import Text.Pretty.Simple import Text.Pretty.Simple
import Text.PrettyPrint qualified as P import Text.PrettyPrint qualified as P
...@@ -129,7 +130,7 @@ run = do ...@@ -129,7 +130,7 @@ run = do
usingLoggerT (filterBySeverity Info msgSeverity $ cmapM fmt logTextStderr) do usingLoggerT (filterBySeverity Info msgSeverity $ cmapM fmt logTextStderr) do
let let
test f = process D ("test " <> Text.pack f) do test f = process D ("test " <> Text.pack f) do
err <- liftIO $ runProcess cmd err <- liftIO $ runProcess (proc cmd [])
log D (Text.pack $ show err) log D (Text.pack $ show err)
pure err pure err
...@@ -167,9 +168,8 @@ run = do ...@@ -167,9 +168,8 @@ run = do
ExitFailure x ExitFailure x
| Just x == validity -> do | Just x == validity -> do
folder <- liftIO do folder <- liftIO do
t <- getCurrentTime temp <- getCanonicalTemporaryDirectory
let folder = "invalid-" <> show decided <> "-" <> iso8601Show t folder <- createTempDirectory temp "rtree-c"
createDirectoryIfMissing False folder
withFile (folder </> "reduction.path") WriteMode \h -> do withFile (folder </> "reduction.path") WriteMode \h -> do
forM (takeWhile ((/= RPath.Undecided) . RPath.choice) l) \(RPath.AnnotatedChoice c' (msg, pos)) -> do forM (takeWhile ((/= RPath.Undecided) . RPath.choice) l) \(RPath.AnnotatedChoice c' (msg, pos)) -> do
hPutStr h [RPath.debugShowChoice c'] hPutStr h [RPath.debugShowChoice c']
...@@ -177,6 +177,7 @@ run = do ...@@ -177,6 +177,7 @@ run = do
hPutStr h msg hPutStr h msg
hPutStr h " at " hPutStr h " at "
hPrint h pos hPrint h pos
copyFile cmd (folder </> takeFileName cmd)
copyFile (f <.> "last") (folder </> takeFileName (f <.> "last")) copyFile (f <.> "last") (folder </> takeFileName (f <.> "last"))
copyFile f (folder </> takeFileName f) copyFile f (folder </> takeFileName f)
pure folder pure folder
......
...@@ -32,6 +32,7 @@ executables: ...@@ -32,6 +32,7 @@ executables:
- directory - directory
- pretty - pretty
- filepath - filepath
- temporary
- co-log - co-log
- time - time
- text - text
......
...@@ -48,6 +48,7 @@ executable rtree-c ...@@ -48,6 +48,7 @@ executable rtree-c
, pretty-simple , pretty-simple
, rtree , rtree
, rtree-c , rtree-c
, temporary
, text , text
, time , time
, transformers , transformers
......
...@@ -575,7 +575,8 @@ reduceCStatement smt labs ctx = case smt of ...@@ -575,7 +575,8 @@ reduceCStatement smt labs ctx = case smt of
exceptIf ("remove expr statement", C.posOf smt) exceptIf ("remove expr statement", C.posOf smt)
e' <- re' e' <- re'
pure $ C.CExpr (Just e') ni pure $ C.CExpr (Just e') ni
Nothing -> Nothing -> do
exceptIf ("remove expr statement", C.posOf smt)
pure $ C.CExpr Nothing ni pure $ C.CExpr Nothing ni
C.CReturn me ni -> do C.CReturn me ni -> do
-- TODO: If function returntype is not struct return 0 -- TODO: If function returntype is not struct return 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment