pgf-server: write stderr to pgf-error.log, since lighttpd closes stderr for fastcgi processes.

This commit is contained in:
bjorn
2008-11-04 09:28:21 +00:00
parent a6905d654d
commit f1fcee964f
2 changed files with 12 additions and 1 deletions

View File

@@ -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] }