diff options
author | Albert Krewinkel <albert@zeitkraut.de> | 2021-10-23 12:55:33 +0200 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2021-10-23 11:12:39 -0700 |
commit | 2d3813e0dd7c2752bf299eb39e0b226d911920f1 (patch) | |
tree | 93626b585566411f5282a4aeb29bccbf63c0a366 /src/Text | |
parent | c8fb1680276ad9c93d9cf35bcdf0e76f16e3d10e (diff) | |
download | pandoc-2d3813e0dd7c2752bf299eb39e0b226d911920f1.tar.gz |
Lua: convert IOErrors to PandocErrors in pandoc.pipe function
Fixes: #7523
Diffstat (limited to 'src/Text')
-rw-r--r-- | src/Text/Pandoc/Lua/Module/Pandoc.hs | 2 |
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 |