| 
      
      
      From: Chen leonard-a. <lia...@mo...> - 2002-03-15 01:33:50
      
     | 
| Hi,
When I try to automate 'ftp' under WINNT(CYGWIN_NT-4.0), I found it acts different from in Linux. Expect is not able to read any thing from 'ftp' in Cygwin. So, why? (the following is the script and logs.)
BRs,
Liang
#----------------------------------
Here's the perl script:
#----------------------------------
use Expect;
# Optional debugging, explained later.
$Expect::Debug=1;
$Expect::Exp_Internal=1;
$Expect::Log_Stdout=1; # On by default.
# Start the process.
$ftp_cmd="ftp";
($sh = Expect->spawn($ftp_cmd)) || die "Couldn't spawn $ftp_cmd, $!";
# wait for anything!
$sh->expect(undef );
#----------------------------------
Here's the log in Cygwin:
#----------------------------------
$ uname
CYGWIN_NT-4.0
God@LIANGCHEN ~/Perl/Tutorial
$ which ftp
/cygdrive/c/WINNT/system32/ftp
God@LIANGCHEN ~/Perl/Tutorial
$ perl -w ftp_expect4.pl
Spawned 'ftp'
        spawn id(3)
        Pid: 413
        Tty: /dev/tty0
        Expect::spawn('Expect', 'ftp') called at ftp_expect4.pl line 21
Starting EXPECT pattern matching...
        Expect::expect('Expect=GLOB(0xa213184)', undef) called at ftp_expect4.pl
 line 24
spawn id(3): beginning expect.
        Timeout: unlimited seconds.
        Current time: Fri Mar 15 09:27:10 2002
spawn id(3): list of patterns:
Waiting for new data (unlimited seconds)...
#----------------------------------
Here's the log in Linux:
#----------------------------------
Spawned 'ftp'
        spawn id(3)
        Pid: 1729
        Tty: /dev/pts/1
        Expect::spawn('Expect', 'ftp') called at ftp_expect4.pl line 21
Starting EXPECT pattern matching...
        Expect::expect('Expect=GLOB(0x82e3320)', undef) called at ftp_expect4.pl line 24
spawn id(3): beginning expect.
        Timeout: unlimited seconds.
        Current time: Thu Mar 14 20:28:06 2002
spawn id(3): list of patterns:
Waiting for new data (unlimited seconds)...
spawn id(3): new data.
spawn id(3): read 5 byte(s).
ftp> 
spawn id(3): Does `ftp> '
match:
Waiting for new data (unlimited seconds)...
 |