[SCM] libmessage-passing-perl Debian packaging branch, master, updated. debian/0.111-3-14-g44f6e88

Tomas Doran bobtfish at bobtfish.net
Mon May 6 11:56:50 UTC 2013


The following commit has been merged in the master branch:
commit ab30c8dfdf75f65ee2a43dcdce0ce55e46e163c4
Author: Tomas Doran <bobtfish at bobtfish.net>
Date:   Sun Apr 15 17:33:18 2012 +0100

    Add daemonize, need pid file next

diff --git a/lib/Log/Stash.pm b/lib/Log/Stash.pm
index 59810a7..f49df2e 100644
--- a/lib/Log/Stash.pm
+++ b/lib/Log/Stash.pm
@@ -7,6 +7,8 @@ use String::RewritePrefix;
 use AnyEvent;
 use JSON::XS;
 use Try::Tiny;
+use Getopt::Long qw(:config pass_through);
+use POSIX;
 use namespace::autoclean;
 use 5.8.4;
 
@@ -55,9 +57,29 @@ sub build_chain {
         };
 }
 
+has daemonize => (
+    is => 'ro',
+    isa => 'Bool',
+    default => 0,
+);
+
+sub deamonize_if_needed {
+    my ($self) = @_;
+    my $daemon = $self->daemonize;
+    if ($daemon) {
+        fork && exit;
+        POSIX::setsid();
+        fork && exit;
+        chdir '/';
+        umask 0;
+    }
+}
+
 sub start {
     my $class = shift;
-    run_log_server $class->new_with_options(@_)->build_chain;
+    my $instance = $class->new_with_options(@_);
+    $instance->deamonize_if_needed;
+    run_log_server $instance->build_chain;
 }
 
 my $json_type = subtype

-- 
libmessage-passing-perl Debian packaging



More information about the Pkg-perl-cvs-commits mailing list