From f1fcee964fb33ab1a165544f728dcbb1d511657d Mon Sep 17 00:00:00 2001 From: bjorn Date: Tue, 4 Nov 2008 09:28:21 +0000 Subject: pgf-server: write stderr to pgf-error.log, since lighttpd closes stderr for fastcgi processes. --- src/server/FastCGIUtils.hs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/server/FastCGIUtils.hs') diff --git a/src/server/FastCGIUtils.hs b/src/server/FastCGIUtils.hs index 615915787..6fef5112d 100644 --- a/src/server/FastCGIUtils.hs +++ b/src/server/FastCGIUtils.hs @@ -1,6 +1,7 @@ {-# LANGUAGE DeriveDataTypeable #-} module FastCGIUtils (initFastCGI, loopFastCGI, throwCGIError, handleCGIErrors, + stderrToFile, outputJSONP, splitBy) where @@ -110,6 +111,13 @@ restartIfModified = logError :: String -> IO () logError s = hPutStrLn stderr s +stderrToFile :: FilePath -> IO () +stderrToFile file = + do let mode = ownerModes `unionFileModes` groupReadMode `unionFileModes` otherReadMode + fileFd <- openFd file WriteOnly (Just mode) (defaultFileFlags { append = True }) + dupTo fileFd stdError + return () + -- * General CGI Error exception mechanism data CGIError = CGIError { cgiErrorCode :: Int, cgiErrorMessage :: String, cgiErrorText :: [String] } -- cgit v1.2.3