diff options
author | 2013-07-17 16:16:17 -0400 | |
---|---|---|
committer | 2013-07-17 16:16:17 -0400 | |
commit | cb0d90daefc659b76c14812205341c375c08e912 (patch) | |
tree | 4083edf619ef08ccd04e6beb16a25cfd885d2e13 /Logs/Transfer.hs | |
parent | c677dca1ad54c77132b8aba3fd3711f7fecbead2 (diff) |
display "transfer already in progress" as a note
Diffstat (limited to 'Logs/Transfer.hs')
-rw-r--r-- | Logs/Transfer.hs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/Logs/Transfer.hs b/Logs/Transfer.hs index 5072ca9aa..d7e25b936 100644 --- a/Logs/Transfer.hs +++ b/Logs/Transfer.hs @@ -118,14 +118,16 @@ runTransfer t file shouldretry a = do info <- liftIO $ startTransferInfo file (meter, tfile, metervar) <- mkProgressUpdater t info mode <- annexFileMode - (fd, cantransfer) <- liftIO $ prep tfile mode info - if cantransfer + (fd, inprogress) <- liftIO $ prep tfile mode info + if inprogress then do + showNote "transfer already in progress" + return False + else do ok <- retry info metervar $ bracketIO (return fd) (cleanup tfile) (const $ a meter) unless ok $ recordFailedTransfer t info return ok - else return False where prep tfile mode info = do #ifndef __WINDOWS__ @@ -133,22 +135,20 @@ runTransfer t file shouldretry a = do openFd (transferLockFile tfile) ReadWrite (Just mode) defaultFileFlags { trunc = True } case mfd of - Nothing -> return (mfd, True) + Nothing -> return (mfd, False) Just fd -> do locked <- catchMaybeIO $ setLock fd (WriteLock, AbsoluteSeek, 0, 0) if isNothing locked - then do - hPutStrLn stderr "transfer already in progress" - return (Nothing, False) + then return (Nothing, True) else do void $ tryIO $ writeTransferInfoFile info tfile - return (mfd, True) + return (mfd, False) #else mfd <- catchMaybeIO $ do writeFile (transferLockFile tfile) "" writeTransferInfoFile info tfile - return (mfd, True) + return (mfd, False) #endif cleanup _ Nothing = noop cleanup tfile (Just fd) = do |