diff options
author | Joey Hess <joeyh@joeyh.name> | 2014-12-22 15:17:00 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2014-12-22 15:17:00 -0400 |
commit | d54ea42de6cbd297d398d4e6f1d27f507a7de5d9 (patch) | |
tree | f7d7e9fdfb591912e76dc7e66b67930cb25b576a /Command | |
parent | 3d75b37447fc4df623eab359a89ce2bdc82ca285 (diff) |
vicfg: Avoid crashing on badly encoded config data.
Diffstat (limited to 'Command')
-rw-r--r-- | Command/Vicfg.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Command/Vicfg.hs b/Command/Vicfg.hs index faa2d3f05..8fc10deb5 100644 --- a/Command/Vicfg.hs +++ b/Command/Vicfg.hs @@ -42,7 +42,7 @@ start = do createAnnexDirectory $ parentDir f cfg <- getCfg descs <- uuidDescriptions - liftIO $ writeFile f $ genCfg cfg descs + liftIO $ writeFileAnyEncoding f $ genCfg cfg descs vicfg cfg f stop @@ -52,11 +52,11 @@ vicfg curcfg f = do -- Allow EDITOR to be processed by the shell, so it can contain options. unlessM (liftIO $ boolSystem "sh" [Param "-c", Param $ unwords [vi, shellEscape f]]) $ error $ vi ++ " exited nonzero; aborting" - r <- parseCfg (defCfg curcfg) <$> liftIO (readFileStrict f) + r <- parseCfg (defCfg curcfg) <$> liftIO (readFileStrictAnyEncoding f) liftIO $ nukeFile f case r of Left s -> do - liftIO $ writeFile f s + liftIO $ writeFileAnyEncoding f s vicfg curcfg f Right newcfg -> setCfg curcfg newcfg |