]> git.proxmox.com Git - pve-common.git/commitdiff
fork_worker: refactor passing $upid to parent for sync
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 15 Dec 2017 16:00:29 +0000 (17:00 +0100)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Mon, 18 Dec 2017 12:37:05 +0000 (13:37 +0100)
STDOUT and $psync[1] are the same here, so no need to differ.
Also we do this only for letting the parent know tha we're ready, the
parent knows the UPID already as it was generated before forking.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/RESTEnvironment.pm

index bab4a2e1843fa763dbeeb0a76ccd973590f1725b..0ad6dbaefc28c96067cae96901ebb845be570c9c 100644 (file)
@@ -482,12 +482,8 @@ sub fork_worker {
        }
 
        # sync with parent (signal that we are ready)
        }
 
        # sync with parent (signal that we are ready)
-       if ($sync) {
-           print "$upid\n";
-       } else {
-           POSIX::write($psync[1], $upid, length ($upid));
-           POSIX::close($psync[1]);
-       }
+       POSIX::write($psync[1], $upid, length ($upid));
+       POSIX::close($psync[1]) if !$sync; # don't need output pipe if async
 
        my $readbuf = '';
        # sync with parent (wait until parent is ready)
 
        my $readbuf = '';
        # sync with parent (wait until parent is ready)