[<<][haskell][>>][..]
Mon Sep 9 12:37:29 IST 2019

Overriding print stdout

How to redirect stdout?
Maybe the realy problem is not to hard-code it in the first place.

EDIT: Use this


logfile = "/home/tom/exo/ghcid/output.log"
withLogfile m = do
  h <- openFile logfile AppendMode
  stdout_dup <- hDuplicate stdout
  stderr_dup <- hDuplicate stderr
  hDuplicateTo h stdout
  hDuplicateTo h stderr
  m
  hClose h
  hDuplicateTo stdout_dup stdout
  hDuplicateTo stderr_dup stderr
  return ()




[Reply][About]
[<<][haskell][>>][..]