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.
This commit is contained in:
parent
99287f4754
commit
20b2269fb7
1 changed files with 4 additions and 1 deletions
|
@ -975,7 +975,10 @@ options =
|
|||
(NoArg
|
||||
(\_ -> do
|
||||
prg <- getProgName
|
||||
defaultDatadir <- getAppUserDataDirectory "pandoc"
|
||||
defaultDatadir <- E.catch
|
||||
(getAppUserDataDirectory "pandoc")
|
||||
(\e -> let _ = (e :: E.SomeException)
|
||||
in return "")
|
||||
UTF8.hPutStrLn stdout (prg ++ " " ++ pandocVersion ++
|
||||
compileInfo ++ "\nDefault user data directory: " ++
|
||||
defaultDatadir ++ copyrightMessage)
|
||||
|
|
Loading…
Add table
Reference in a new issue