summaryrefslogtreecommitdiffstats
path: root/lib/OpenSLX/Basics.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/OpenSLX/Basics.pm')
-rw-r--r--lib/OpenSLX/Basics.pm22
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/OpenSLX/Basics.pm b/lib/OpenSLX/Basics.pm
index 937c99c7..f673d279 100644
--- a/lib/OpenSLX/Basics.pm
+++ b/lib/OpenSLX/Basics.pm
@@ -23,7 +23,8 @@ $VERSION = 1.01;
@EXPORT = qw(
&openslxInit %openslxConfig %cmdlineConfig
&_tr &trInit
- &warn &die &executeInSubprocess &slxsystem
+ &warn &die
+ &callInSubprocess &executeInSubprocess &slxsystem
&vlog
&instantiateClass
&addCleanupFunction &removeCleanupFunction
@@ -298,7 +299,7 @@ sub _tr
}
# ------------------------------------------------------------------------------
-sub executeInSubprocess
+sub callInSubprocess
{
my $childFunc = shift;
@@ -324,6 +325,23 @@ sub executeInSubprocess
}
# ------------------------------------------------------------------------------
+sub executeInSubprocess
+{
+ my @cmdlineArgs = @_;
+
+ my $pid = fork();
+ if (!$pid) {
+ # child...
+ # ...exec the given cmdline:
+ exec(@cmdlineArgs);
+ die _tr("error in exec('%s')! (%s)", join(' ', @cmdlineArgs), $!);
+ }
+
+ # parent...
+ return $pid;
+}
+
+# ------------------------------------------------------------------------------
sub addCleanupFunction
{
my $name = shift;