summaryrefslogtreecommitdiff
path: root/Command/Vicfg.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2014-12-22 15:17:00 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2014-12-22 15:17:00 -0400
commitd54ea42de6cbd297d398d4e6f1d27f507a7de5d9 (patch)
treef7d7e9fdfb591912e76dc7e66b67930cb25b576a /Command/Vicfg.hs
parent3d75b37447fc4df623eab359a89ce2bdc82ca285 (diff)
vicfg: Avoid crashing on badly encoded config data.
Diffstat (limited to 'Command/Vicfg.hs')
-rw-r--r--Command/Vicfg.hs6
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