Created
November 5, 2019 13:44
-
-
Save negokaz/d561fb3ccf113958862bd5ff4e7b0f6e to your computer and use it in GitHub Desktop.
A Perl implementation of setsid(1)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# | |
# A Perl implementation of setsid(1) | |
# | |
# setsid(1) - run a program in a new session | |
# http://man7.org/linux/man-pages/man1/setsid.1.html | |
use POSIX setsid; | |
setsid() or die "Failed to create new session"; | |
exec @ARGV; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There is a bug there and it is important:
`use POSIX ();
fork() && exit(0);
POSIX::setsid() or die $!;
exec @argv;
`