You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by fr...@apache.org on 2017/04/28 14:29:50 UTC

[2/3] incubator-trafficcontrol git commit: add STDOUT, STDIN, STDERR re-direct back

add STDOUT, STDIN, STDERR re-direct back

(cherry picked from commit 8e568ae91742b5b2413016a6712ea67c99eeb88b)


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/87c3d2e0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/87c3d2e0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/87c3d2e0

Branch: refs/heads/2.0.x
Commit: 87c3d2e02ace056551316ad5798301471fe6e823
Parents: 18c21ba
Author: David Neuman <da...@gmail.com>
Authored: Wed Apr 26 08:47:01 2017 -0600
Committer: David Neuman <da...@gmail.com>
Committed: Wed Apr 26 13:48:47 2017 -0600

----------------------------------------------------------------------
 traffic_ops/app/lib/MojoPlugins/Daemonize.pm | 6 ++++++
 1 file changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/87c3d2e0/traffic_ops/app/lib/MojoPlugins/Daemonize.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/MojoPlugins/Daemonize.pm b/traffic_ops/app/lib/MojoPlugins/Daemonize.pm
index 5037031..c2c4a9e 100755
--- a/traffic_ops/app/lib/MojoPlugins/Daemonize.pm
+++ b/traffic_ops/app/lib/MojoPlugins/Daemonize.pm
@@ -41,6 +41,12 @@ sub register {
 				# This is the first child
 				$self->inactivity_timeout(0);
 				POSIX::setsid();
+				open( STDIN, "< /dev/null" )
+					|| confess("Can't read /dev/null: $!");
+				open( STDOUT, "> /dev/null" )
+					|| confess("Can't write to /dev/null: $!");
+				open( STDERR, "> /dev/null" )
+					|| confess("Can't write to /dev/null: $!");
 				# First child forks daemon and exits with a value that signals the parent how the fork went
     			my $pid  = fork();