lib/scripts/system.pl
changeset 26092 260cca2e16fa
child 26096 783f957dcb01
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lib/scripts/system.pl	Mon Feb 18 21:33:29 2008 +0100
@@ -0,0 +1,26 @@
+#
+# $Id$
+# Author: Makarius
+#
+# system.pl - invoke shell command line (with robust signal handling)
+#
+
+# args
+
+($group, $script_name, $pid_name, $output_name) = @ARGV;
+
+
+# process id
+
+if ($group eq "group") { setpgrp; }
+
+open (PID_FILE, ">", $pid_name) || die $!;
+print PID_FILE "$$\n";
+close PID_FILE;
+
+
+# exec script
+
+$SIG{'INT'} = "DEFAULT";   #paranoia setting, required for Cygwin
+exec qq/exec bash '$script_name' > '$output_name'/;
+