Text.Pandoc.Process

pandoc-3.7.0.2: Conversion between markup formats

Copyright | Copyright (C) 2013-2024 John MacFarlane
License | GNU GPL, version 2 or above
Maintainer | John MacFarlane <jgm@berkeley.edu>
Stability | alpha
Portability | portable
Safe Haskell | Safe-Inferred
Language | Haskell2010

Text.Pandoc.Process

Description

ByteString variant of `readProcessWithExitCode`.

Synopsis

- pipeProcess :: Maybe [(String, String)] -> FilePath -> [String] -> ByteString -> IO (ExitCode, ByteString)

# Documentation

pipeProcess #

Arguments

:: Maybe [(String, String)] | environment variables
-> FilePath | Filename of the executable (see `proc` for details)
-> [String] | any arguments
-> ByteString | standard input
-> IO (ExitCode, ByteString) | exitcode, stdout

Version of `readProcessWithExitCode` that uses lazy bytestrings instead of strings and allows setting environment variables.

`readProcessWithExitCode` creates an external process, reads its standard output strictly, waits until the process terminates, and then returns the `ExitCode` of the process and the standard output. stderr is inherited from the parent.

If an asynchronous exception is thrown to the thread executing `readProcessWithExitCode`, the forked process will be terminated and `readProcessWithExitCode` will wait (block) until the process has been terminated.

This function was adapted from `readProcessWithExitCode` of module System.Process, package process-1.6.3.0. The original code is BSD licensed and © University of Glasgow 2004-2008.