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
redir nullfd stdInput
redirLog =<< openlogfd
when changedirectory $
setCurrentDirectory "/"
environ <- getEnvironment
_ <- createProcess $
(proc cmd (toCommand params))
{ env = Just (addEntry envvar cmd environ)
, create_group = True
, new_session = True
, cwd = if changedirectory then Just "/" else Nothing
}
return ()
where