aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2021-10-23 12:55:33 +0200
committerJohn MacFarlane <jgm@berkeley.edu>2021-10-23 11:12:39 -0700
commit2d3813e0dd7c2752bf299eb39e0b226d911920f1 (patch)
tree93626b585566411f5282a4aeb29bccbf63c0a366 /src
parentc8fb1680276ad9c93d9cf35bcdf0e76f16e3d10e (diff)
downloadpandoc-2d3813e0dd7c2752bf299eb39e0b226d911920f1.tar.gz
Lua: convert IOErrors to PandocErrors in pandoc.pipe function
Fixes: #7523
Diffstat (limited to 'src')
-rw-r--r--src/Text/Pandoc/Lua/Module/Pandoc.hs2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/Text/Pandoc/Lua/Module/Pandoc.hs b/src/Text/Pandoc/Lua/Module/Pandoc.hs
index ef1d6f078..eeadfa340 100644
--- a/src/Text/Pandoc/Lua/Module/Pandoc.hs
+++ b/src/Text/Pandoc/Lua/Module/Pandoc.hs
@@ -18,6 +18,7 @@ module Text.Pandoc.Lua.Module.Pandoc
import Prelude hiding (read)
import Control.Applicative (optional)
import Control.Monad ((>=>), forM_, when)
+import Control.Monad.Catch (catch, throwM)
import Control.Monad.Except (throwError)
import Data.Default (Default (..))
import Data.Maybe (fromMaybe)
@@ -206,6 +207,7 @@ pipe :: String -- ^ path to executable
-> PandocLua NumResults
pipe command args input = liftPandocLua $ do
(ec, output) <- Lua.liftIO $ pipeProcess Nothing command args input
+ `catch` (throwM . PandocIOError "pipe")
case ec of
ExitSuccess -> 1 <$ Lua.push output
ExitFailure n -> do