summaryrefslogtreecommitdiff
path: root/src/Hakyll/Core
diff options
context:
space:
mode:
authorJasper Van der Jeugt <m@jaspervdj.be>2014-03-26 12:09:35 +0100
committerJasper Van der Jeugt <m@jaspervdj.be>2014-03-26 12:09:35 +0100
commit0b705d7db07a9ab637853bcf4bd69da075851d48 (patch)
treeed90ceb3f8431ccc181718465034002213e983a6 /src/Hakyll/Core
parent87eafc752f223f70f895f1aa9afcec2eb1b042c4 (diff)
downloadhakyll-0b705d7db07a9ab637853bcf4bd69da075851d48.tar.gz
Micro cleanup of pull request #233
Diffstat (limited to 'src/Hakyll/Core')
-rw-r--r--src/Hakyll/Core/UnixFilter.hs16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/Hakyll/Core/UnixFilter.hs b/src/Hakyll/Core/UnixFilter.hs
index e9a2cc1..fd3c335 100644
--- a/src/Hakyll/Core/UnixFilter.hs
+++ b/src/Hakyll/Core/UnixFilter.hs
@@ -19,7 +19,7 @@ import System.Exit (ExitCode (..))
import System.IO (Handle, hClose, hFlush, hGetContents,
hPutStr, hSetEncoding, localeEncoding)
import System.Process
-import System.Info
+import qualified System.Info as System
--------------------------------------------------------------------------------
import Hakyll.Core.Compiler
@@ -105,9 +105,17 @@ unixFilterIO :: Monoid o
-> i
-> IO (o, String, ExitCode)
unixFilterIO writer reader programName args input = do
- let pr = if os == "mingw32"
- then shell $ unwords (programName : args)
- else proc programName args
+ -- The problem on Windows is that `proc` is that it is unable to execute
+ -- batch stubs (eg. anything created using 'gem install ...') even if its in
+ -- `$PATH`. A solution to this issue is to execute the batch file explicitly
+ -- using `cmd /c batchfile` but there is no rational way to know where said
+ -- batchfile is on the system. Hence, we detect windows using the
+ -- `System.Info` module and then instead of using `proc` to create the
+ -- process, use `shell` instead which will be able to execute everything
+ -- `proc` can, and this can deal with batch files as well.
+ let pr = if System.os == "mingw32"
+ then shell $ unwords (programName : args)
+ else proc programName args
(Just inh, Just outh, Just errh, pid) <-
createProcess pr