set cwd rarher than changing current process directory

This is not actually used in git-annex though.
This commit is contained in:
Joey Hess 2021-05-12 17:44:22 -04:00
parent 6eadcab5bf
commit 4de3351c5c
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38

View file

@ -52,14 +52,13 @@ daemonize cmd params openlogfd pidfile changedirectory a = do
nullfd <- openFd "/dev/null" ReadOnly Nothing defaultFileFlags nullfd <- openFd "/dev/null" ReadOnly Nothing defaultFileFlags
redir nullfd stdInput redir nullfd stdInput
redirLog =<< openlogfd redirLog =<< openlogfd
when changedirectory $
setCurrentDirectory "/"
environ <- getEnvironment environ <- getEnvironment
_ <- createProcess $ _ <- createProcess $
(proc cmd (toCommand params)) (proc cmd (toCommand params))
{ env = Just (addEntry envvar cmd environ) { env = Just (addEntry envvar cmd environ)
, create_group = True , create_group = True
, new_session = True , new_session = True
, cwd = if changedirectory then Just "/" else Nothing
} }
return () return ()
where where