Permalink
Browse files

Compilation fixes for Scan.hs

  • Loading branch information...
1 parent fa65209 commit b0707ca58bea1f810966e641e351ae500542083c @jgoerzen committed Apr 25, 2008
Showing with 10 additions and 5 deletions.
  1. +5 −2 Commands/Scan.hs
  2. +5 −3 Utils.hs
View
@@ -21,15 +21,18 @@ import System.Console.GetOpt.Utils
import System.Cmd.Utils
import Utils
import HSH
+import System.IO
cmd = simpleCmd "scan"
"Read a plain tar file and produce an index file for it" helptext
[]
cmd_worker
cmd_worker ([], []) = bracketFIFO "tarf-scan.XXXXXX" $ \fifoname ->
- do progname <- getProgram "tarf-encoder"
- runIO $ ("tarf-encoder", ["cat", fifoname]) -|-
+ do hSetBuffering stdin (BlockBuffering (Just 10240))
+ hSetBuffering stdout LineBuffering
+ progname <- getProgram "tarf-encoder"
+ runIO $ (progname, ["cat", fifoname]) -|-
discard -|- catFromBS [fifoname]
cmd_worker _ =
View
@@ -22,6 +22,7 @@ import System.Environment
import HSH
import System.Path
import System.Posix.Files(createNamedPipe)
+import System.Directory(getTemporaryDirectory)
data Command =
Command {cmdname :: String,
@@ -61,8 +62,9 @@ getProgram x =
bracketFIFO :: String -> (String -> IO a) -> IO a
bracketFIFO pattern func =
- brackettmpdir pattern fifofunc
- where fifofunc dirname =
- let fifoname = dirname ++ "/" ++ "fifo"
+ do tmpdir <- getTemporaryDirectory
+ brackettmpdir (tmpdir ++ "/" ++ pattern) fifofunc
+ where fifofunc tmpdirname =
+ let fifoname = tmpdirname ++ "/" ++ "fifo"
in do createNamedPipe fifoname 0o600
func fifoname

0 comments on commit b0707ca

Please sign in to comment.