Skip to content

Commit 7986405

Browse files
author
Alessandro Chitolina
committed
change user after fork and file opening
1 parent 0b54fa6 commit 7986405

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/Master.php

+6-4
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ public function run()
5757
$this->eventDispatcher->dispatch(Events::START);
5858
ErrorHandlerUtil::setLogger($this->logger);
5959

60+
$masterOptions = $this->container->getParameter('master');
61+
62+
$currentProcess = $this->container->get('process');
63+
$currentProcess->setUser($masterOptions['user']);
64+
$currentProcess->setGroup($masterOptions['group']);
65+
6066
$this->running = true;
6167

6268
$this->installSignalHandlers();
@@ -105,10 +111,6 @@ public function sanityCheck()
105111
private function daemonize()
106112
{
107113
$currentProcess = $this->container->get('process');
108-
$masterOptions = $this->container->getParameter('master');
109-
110-
$currentProcess->setUser($masterOptions['user']);
111-
$currentProcess->setGroup($masterOptions['group']);
112114

113115
// Double fork magic, to prevent daemon to acquire a tty
114116
if ($pid = $currentProcess->fork()) {

0 commit comments

Comments
 (0)