From 4de3351c5c068e231e47d9cfbc54cd99974ac6ad Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 12 May 2021 17:44:22 -0400 Subject: [PATCH] set cwd rarher than changing current process directory This is not actually used in git-annex though. --- Utility/Daemon.hs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Utility/Daemon.hs b/Utility/Daemon.hs index 60dc2cafa7..3a0cc5baeb 100644 --- a/Utility/Daemon.hs +++ b/Utility/Daemon.hs @@ -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