summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJoey Hess2015-10-28 11:44:05 -0400
committerJoey Hess2015-10-28 11:44:05 -0400
commit21a74a3ffea3d48195d76486a56031b317fa23fa (patch)
tree36772b12f03adafe57d12ee176544660537fafce /src
parent0b9c4a5396876d06406a67e0ee4dcfd1820f677a (diff)
propellor spin
Diffstat (limited to 'src')
-rw-r--r--src/Propellor/Spin.hs5
-rw-r--r--src/Utility/ConcurrentOutput.hs28
2 files changed, 14 insertions, 19 deletions
diff --git a/src/Propellor/Spin.hs b/src/Propellor/Spin.hs
index 0c457705..36859fb7 100644
--- a/src/Propellor/Spin.hs
+++ b/src/Propellor/Spin.hs
@@ -206,7 +206,10 @@ updateServer target relay hst connect haveprecompiled getprivdata =
sendRepoUrl toh
loop
(Just NeedPrivData) -> do
- sendPrivData hn toh =<< getprivdata
+ print "START GET PRIVDATA"
+ pd <- getprivdata
+ print "GOT PRIVDATA"
+ sendPrivData hn toh pd
loop
(Just NeedGitClone) -> do
hClose toh
diff --git a/src/Utility/ConcurrentOutput.hs b/src/Utility/ConcurrentOutput.hs
index 35904cb7..8a4bdcf2 100644
--- a/src/Utility/ConcurrentOutput.hs
+++ b/src/Utility/ConcurrentOutput.hs
@@ -130,23 +130,19 @@ updateOutputLocker l = do
-- as the output lock becomes free.
createProcessConcurrent :: P.CreateProcess -> IO (Maybe Handle, Maybe Handle, Maybe Handle, P.ProcessHandle)
createProcessConcurrent p
- | hasoutput (P.std_out p) || hasoutput (P.std_err p) =
+ | willoutput (P.std_out p) || willoutput (P.std_err p) =
ifM tryTakeOutputLock
- ( do
- print ("FIRST", pc)
- firstprocess
- , do
- print ("CONCURRENT", pc)
- concurrentprocess
+ ( firstprocess
+ , concurrentprocess
)
| otherwise = P.createProcess p
where
- hasoutput P.Inherit = True
- hasoutput _ = False
+ willoutput P.Inherit = True
+ willoutput _ = False
- pc = case P.cmdspec p of
- P.ShellCommand s -> s
- P.RawCommand c ps -> unwords (c:ps)
+ rediroutput str h
+ | willoutput str = P.UseHandle h
+ | otherwise = str
firstprocess = do
r@(_, _, _, h) <- P.createProcess p
@@ -161,12 +157,8 @@ createProcessConcurrent p
(toouth, fromouth) <- pipe
(toerrh, fromerrh) <- pipe
let p' = p
- { P.std_out = if hasoutput (P.std_out p)
- then P.UseHandle toouth
- else P.std_out p
- , P.std_err = if hasoutput (P.std_err p)
- then P.UseHandle toerrh
- else P.std_err p
+ { P.std_out = rediroutput (P.std_out p) toouth
+ , P.std_err = rediroutput (P.std_err p) toerrh
}
r <- P.createProcess p'
hClose toouth