Test-NoTty
view release on metacpan or search on metacpan
lib/Test/NoTty.pm view on Meta::CPAN
use warnings;
package Test::NoTty;
use parent qw(Exporter);
use POSIX qw(setsid _exit WIFEXITED WEXITSTATUS WIFSIGNALED WTERMSIG);
our @EXPORT = 'without_tty';
our $VERSION = '0.03';
sub without_tty(&@) {
my ($code, @args) = @_;
pipe my $reader, my $writer
or die "Can't pipe: $!";
# So, "how to detach from your controlling terminal" is a subset of the "how
# to start a daemon" dance. In (reverse) you
#
# 2) Call setsid when your process is not a process group leader.
# This detaches you from any controlling terminal
# 1) fork, as the child process won't be a process group leader.
( run in 0.685 second using v1.01-cache-2.11-cpan-49f99fa48dc )