diff options
author | Joey Hess <joey@kitenet.net> | 2013-11-12 14:54:02 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-11-12 17:22:34 -0400 |
commit | d03bfb7355d11e271664d4dea51449f8f5059780 (patch) | |
tree | 638b735821c6074f31e8556f71d7f6b1f04eb1dd /Assistant/Ssh.hs | |
parent | f869020577d759313494828d1973adcf2916b392 (diff) |
build assistant and watcher on windows (doesn't work yet)
Diffstat (limited to 'Assistant/Ssh.hs')
-rw-r--r-- | Assistant/Ssh.hs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/Assistant/Ssh.hs b/Assistant/Ssh.hs index f316aa500..1dc982ba6 100644 --- a/Assistant/Ssh.hs +++ b/Assistant/Ssh.hs @@ -12,6 +12,7 @@ import Utility.Tmp import Utility.UserInfo import Utility.Shell import Utility.Rsync +import Utility.FileMode import Git.Remote import Data.Text (Text) @@ -233,12 +234,8 @@ setupSshKeyPair sshkeypair sshdata = do sshdir <- sshDir createDirectoryIfMissing True $ parentDir $ sshdir </> sshprivkeyfile - unlessM (doesFileExist $ sshdir </> sshprivkeyfile) $ do - h <- fdToHandle =<< - createFile (sshdir </> sshprivkeyfile) - (unionFileModes ownerWriteMode ownerReadMode) - hPutStr h (sshPrivKey sshkeypair) - hClose h + unlessM (doesFileExist $ sshdir </> sshprivkeyfile) $ + writeFileProtected (sshdir </> sshprivkeyfile) (sshPrivKey sshkeypair) unlessM (doesFileExist $ sshdir </> sshpubkeyfile) $ writeFile (sshdir </> sshpubkeyfile) (sshPubKey sshkeypair) |