@@ -1,3 +1,5 @@
1--------------------------------------------------------------------------------
3--------------------------------------------------------------------------------
2-- | A Compiler that supports unix filters.
4-- | A Compiler that supports unix filters.
3module Hakyll.Core.UnixFilter
5module Hakyll.Core.UnixFilter
@@ -19,7 +21,6 @@ import System.Exit (ExitCode (..))
19import System.IO (Handle, hClose, hFlush, hGetContents,
21import System.IO (Handle, hClose, hFlush, hGetContents,
20 hPutStr, hSetEncoding, localeEncoding)
22 hPutStr, hSetEncoding, localeEncoding)
21import System.Process
23import System.Process
22−import qualified System.Info as System
24--------------------------------------------------------------------------------
25--------------------------------------------------------------------------------
25import Hakyll.Core.Compiler
26import Hakyll.Core.Compiler
@@ -105,17 +106,19 @@ unixFilterIO :: Monoid o
106 -> IO (o, String, ExitCode)
107 -> IO (o, String, ExitCode)
107unixFilterIO writer reader programName args input = do
108unixFilterIO writer reader programName args input = do
108− -- The problem on Windows is that `proc` is that it is unable to execute
109+ -- The problem on Windows is that `proc` is unable to execute
109 -- batch stubs (eg. anything created using 'gem install ...') even if its in
110 -- batch stubs (eg. anything created using 'gem install ...') even if its in
110 -- `$PATH`. A solution to this issue is to execute the batch file explicitly
111 -- `$PATH`. A solution to this issue is to execute the batch file explicitly
111 -- using `cmd /c batchfile` but there is no rational way to know where said
112 -- using `cmd /c batchfile` but there is no rational way to know where said
112 -- batchfile is on the system. Hence, we detect windows using the
113 -- batchfile is on the system. Hence, we detect windows using the
113− -- `System.Info` module and then instead of using `proc` to create the
114+ -- CPP and instead of using `proc` to create the process, use `shell`
114− -- process, use `shell` instead which will be able to execute everything
115+ -- which will be able to execute everything `proc` can
115− -- `proc` can, and this can deal with batch files as well.
116+ -- as well as batch files.
116− let pr = if System.os == "mingw32"
117+#ifdef mingw32_HOST_OS
117− then shell $ unwords (programName : args)
118+ let pr = shell $ unwords (programName : args)
118− else proc programName args
120+ let pr = proc programName args
120 (Just inh, Just outh, Just errh, pid) <-
123 (Just inh, Just outh, Just errh, pid) <-
121 createProcess pr
124 createProcess pr