- $! = 0;
- $pid = fork;
- if ($pid == 0) {
- # pretend to be systemd
- my $fl = fcntl($sock, F_GETFD, 0);
- dup2(fileno($sock), 3) or die "dup2 failed: $!\n";
- dup2(1, 2) or die "dup2 failed: $!\n";
- fcntl($sock, F_SETFD, $fl &= ~FD_CLOEXEC);
- $ENV{LISTEN_PID} = $$;
- $ENV{LISTEN_FDS} = 1;
- $ENV{PI_CONFIG} = $pi_config;
- exec $nntpd, '-W0';
- die "FAIL: $!\n";
- }
- ok(defined $pid, 'forked nntpd process successfully');
+ my $cmd = [ $nntpd, '-W0' ];
+ $pid = spawn_listener({ PI_CONFIG => $pi_config }, $cmd, [$sock]);