diff options
author | brunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-06-03 20:26:37 +0000 |
---|---|---|
committer | brunsch <brunsch@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1998-06-03 20:26:37 +0000 |
commit | 33af26748dabc45187d3c4b93426ce86086161e8 (patch) | |
tree | 4e2a25fbb124b6abaf82c4b289422907ecddd45e /bin | |
parent | 025931c1943279a6917f94f32d11016ea9c0ff9c (diff) | |
download | ATCD-33af26748dabc45187d3c4b93426ce86086161e8.tar.gz |
Process modules for perl scripts.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/Process.pm | 12 | ||||
-rw-r--r-- | bin/Process_Unix.pm | 35 | ||||
-rw-r--r-- | bin/Process_Win32.pm | 29 |
3 files changed, 76 insertions, 0 deletions
diff --git a/bin/Process.pm b/bin/Process.pm new file mode 100644 index 00000000000..46deb2f572e --- /dev/null +++ b/bin/Process.pm @@ -0,0 +1,12 @@ +$inc = "Process_Unix.pm"; +$DIR_SEPARATOR = "/"; + +if ($^O eq "MSWin32") +{ + $inc = "Process_Win32.pm"; + $DIR_SEPARATOR = "\\"; +} + +require $inc; + +1;
\ No newline at end of file diff --git a/bin/Process_Unix.pm b/bin/Process_Unix.pm new file mode 100644 index 00000000000..0537074dbb7 --- /dev/null +++ b/bin/Process_Unix.pm @@ -0,0 +1,35 @@ +package Process; + +$EXE_EXT = ""; + +sub Create +{ + my $name = shift; + my $args = shift; + my $self = []; + unless ($self->[0] = fork ()) + { + unless (fork ()) + { + exec $name." ".$args; + die "no exec"; + } + exit 0; + } + bless $self; +} + +sub Kill +{ + my $self = shift; + kill (1, $self->[0]); +} + +sub Wait +{ + my $self = shift; + waitpid ($self->[0], 0); +} + + +1; diff --git a/bin/Process_Win32.pm b/bin/Process_Win32.pm new file mode 100644 index 00000000000..bf850022d03 --- /dev/null +++ b/bin/Process_Win32.pm @@ -0,0 +1,29 @@ +package Process; + +use Win32::Process; + +$EXE_EXT = ".exe"; + +sub Create +{ + my $name = shift; + my $args = shift; + my $self = []; + Win32::Process::Create ($self->[0], $name, $name." ".$args, 0, + CREATE_NEW_CONSOLE, "."); + bless $self; +} + +sub Kill +{ + my $self = shift; + Win32::Process::Kill ($self->[0], -1); +} + +sub Wait +{ + my $self = shift; + Win32::Process::Wait ($self->[0], INFINITE); +} + +1;
\ No newline at end of file |