From aa3b6b8df6167282a8bbebe738c4ff1df45da8cf Mon Sep 17 00:00:00 2001 From: Olle Fredriksson Date: Thu, 9 Nov 2017 21:43:07 +0100 Subject: [PATCH] Make output file path absolute Fixes an issue where the `run` command won't work if an output file is also given (with `-o`). --- src/Command/Compile.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Command/Compile.hs b/src/Command/Compile.hs index dfe0265..9a91f26 100644 --- a/src/Command/Compile.hs +++ b/src/Command/Compile.hs @@ -115,12 +115,15 @@ compile opts onError onSuccess = case maybe (Right Target.defaultTarget) Target. withAssemblyDir (Just dir) k = do createDirectoryIfMissing True dir k dir + withOutputFile Nothing k = withTempFile firstInputDir firstFileName $ \outputFile outputFileHandle -> do hClose outputFileHandle k outputFile + withOutputFile (Just o) k = do + o' <- makeAbsolute o + k o' - withOutputFile (Just o) k = k o withLogHandle Nothing k = k stdout withLogHandle (Just file) k = withFile file WriteMode k