Support filenames that start with a dash; when such a file is passed to a utility it will be escaped to avoid it being interpreted as an option.

This commit is contained in:
Joey Hess 2011-02-25 01:13:01 -04:00
parent e61b47bc8a
commit 836e71297b
9 changed files with 29 additions and 10 deletions

View file

@ -24,11 +24,12 @@ rsyncShell command = ["-e", unwords $ map escape command]
{- Runs rsync in server mode to send a file, and exits. -}
rsyncServerSend :: FilePath -> IO ()
rsyncServerSend file = rsyncExec $ rsyncServerParams ++ ["--sender", file]
rsyncServerSend file = rsyncExec $
rsyncServerParams ++ ["--sender", utilityEscape file]
{- Runs rsync in server mode to receive a file. -}
rsyncServerReceive :: FilePath -> IO Bool
rsyncServerReceive file = rsync $ rsyncServerParams ++ [file]
rsyncServerReceive file = rsync $ rsyncServerParams ++ [utilityEscape file]
rsyncServerParams :: [String]
rsyncServerParams =