git.iko.soy/typeable/pandoc
on master help sign in
In --version, trap error in getAppUserDataDirectory.

This fixes a crash with `pandoc --version` on unusual systems with no real user (e.g. SQL Server 2016). Closes #3241.

commit20b2269fb7d0ccc06622637a713e469265c88eea authorJohn MacFarlane <jgm@berkeley.edu> dateFri 18 Nov 2016, 11:25 (10 years ago) parent99287f4
1 file changed+4−1
pandoc.hs+4−1
pandoc.hs+4−1
@@ -975,7 +975,10 @@ options =
975975 (NoArg
976976 (\_ -> do
977977 prg <- getProgName
978− defaultDatadir <- getAppUserDataDirectory "pandoc"
978+ defaultDatadir <- E.catch
979+ (getAppUserDataDirectory "pandoc")
980+ (\e -> let _ = (e :: E.SomeException)
981+ in return "")
979982 UTF8.hPutStrLn stdout (prg ++ " " ++ pandocVersion ++
980983 compileInfo ++ "\nDefault user data directory: " ++
981984 defaultDatadir ++ copyrightMessage)