aboutsummaryrefslogtreecommitdiff
path: root/pandoc-cli/no-server/PandocCLI/Server.hs
blob: f52805cbb6ca2d604755c57725e5dae395e48939 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{- |
   Module      : PandocCLI.Server
   Copyright   : © 2006-2024 John MacFarlane
   License     : GPL-2.0-or-later
   Maintainer  : John MacFarlane <jgm@berkeley@edu>

Placeholder module to be used when pandoc is compiled without server
support.
-}
module PandocCLI.Server
  ( runCGI
  , runServer
  )
where

import System.IO (hPutStrLn, stderr)
import System.Exit (exitWith, ExitCode(ExitFailure))

-- | Placeholder function for the CGI server; prints an error message
-- and exists with error code.
runCGI :: IO ()
runCGI = serverUnsupported

-- | Placeholder function for the HTTP server; prints an error message
-- and exists with error code.
runServer :: [String] -> IO ()
runServer _args = serverUnsupported

serverUnsupported :: IO ()
serverUnsupported = do
  hPutStrLn stderr $ "Server mode unsupported.\n" <>
                     "Pandoc was not compiled with the 'server' flag."
  exitWith $ ExitFailure 4