Hello...
I am using the IPC::Open2 package, and specifically the open2 function in
one of my programs. I am running
ActiveState Perl on a PC running Windows 2000 with Cygwin. When calling the
open2 function, everything seems
to work properly except the return value. The PID returned by the open2
function is actually the PPID or PGID (as
seen by the example below).
test case:
my $pid = open2(\*FROM_TGT,\*TO_TGT,"rlogin $target") or die "Unable
to open rlogin to $target\n";
print "open2 returned pid -> $pid \n";
my $cmd = `ps | grep rlogin`;
print "ps returned -> \n $cmd \n";
output:
open2 returned pid -> 3212
ps returned ->
3436 3212 3212 3436 con 1005 15:11:35 /usr/bin/rlogin
(where ps returns in the format: PID PPID PGID WINPID TTY UID
STIME COMMAND)
I would expect the return value to be 3436 in this case, unless I am
misinterpreting the open2 function specification.
Reference Bug 14486 | Opened: 1999-10-12 20:37:00. If further information
is needed, please let me know. I attached
my configuration to the bottom of the email as well. Thanks,
Matt Tokarsky
(Belcan Co.)
GE Aircraft Engines
1 Neumann Way
Cincinnati, OH 45215
Phone: (513)243-6874
Email: matt.t...@ae.ge.com
****************************************************************************
******************************************************************
Configuration
****************************************************************************
******************************************************************
perl -v
This is perl, v5.8.3 built for MSWin32-x86-multi-thread
(with 8 registered patches, see perl -V for more detail)
Copyright 1987-2003, Larry Wall
Binary build 809 provided by ActiveState Corp. http://www.ActiveState.com
ActiveState is a division of Sophos.
Built Feb 3 2004 00:28:51
Perl may be copied only under the terms of either the Artistic License or
the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using `man perl' or `perldoc perl'. If you have access to the
Internet, point your browser at http://www.perl.com/, the Perl Home Page.
----------------------------------------------------------------------------
----------------------------------------------------------------------------
---------------------------
perl -V
Summary of my perl5 (revision 5 version 8 subversion 3) configuration:
Platform:
osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
uname=''
config_args='undef'
hint=recommended, useposix=true, d_sigaction=undef
usethreads=undef use5005threads=undef useithreads=define
usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cl', ccflags ='-nologo -Gf -W3 -MD -Zi -DNDEBUG -O1 -DWIN32
-D_CONSOLE -DNO_STRICT
-DHAVE_DES_FCRYPT -DNO_HASH_SEED -DPERL_IMPLICIT_CONTEXT
-DPERL_IMPLICIT_SYS -DUSE_PERLI
O -DPERL_MSVCRT_READFIX',
optimize='-MD -Zi -DNDEBUG -O1',
cppflags='-DWIN32'
ccversion='', gccversion='', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64',
lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='link', ldflags ='-nologo -nodefaultlib -debug -opt:ref,icf
-libpath:"C:\Apps\Perl
\lib\CORE" -machine:x86'
libpth=C:/Apps/Perl/lib/CORE
libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advap
i32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib
wsock32.lib mpr.lib winm
m.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib
perllibs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib a
dvapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib
wsock32.lib mpr.lib
winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib
libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib
gnulibc_version='undef'
Dynamic Linking:
dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -debug
-opt:ref,icf -libpath:"C
:\Apps\Perl\lib\CORE" -machine:x86'
Characteristics of this binary (from libperl):
Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES
PERL_IMPLICIT_CONTEXT PE
RL_IMPLICIT_SYS
Locally applied patches:
ActivePerl Build 809
22218 Remove the caveat about detached threads crashing on Windows
22201 Avoid threads+win32 crash by freeing Perl interpreter slightly
later
22169 Display 'out of memeory' errors using low-level I/O
22159 Upgrade to Time::Hires 1.55
22120 Make 'Configure -Dcf_by=...' work
22051 Upgrade to Time::HiRes 1.54
21540 Fix backward-compatibility issues in if.pm
Built under MSWin32
Compiled at Feb 3 2004 00:28:51
%ENV:
PERL5LIB="/d/Apps/Perl/lib;D:/users/ngbepgt/dev/bin;C:/Progra~1/Rational/Ros
eRe~1/bin/
win32/cmscripts/escl"
PERL5SHELL="sh -c "
@INC:
/d/Apps/Perl/lib
D:/users/ngbepgt/dev/bin
C:/Progra~1/Rational/RoseRe~1/bin/win32/cmscripts/escl
C:/Apps/Perl/lib
C:/Apps/Perl/site/lib
.
That will start a shell process (3212) which will run rlogin in a
subprocess (3436).
If you aren't using any shell features (such as glob expansion or
redirection), always call your command directly:
my $pid = open2(\*FROM_TGT,\*TO_TGT, 'rlogin', $target)
Mike Guy