Expect.pm
From: Mike (mikee_at_mikee.ath.cx)
Date: 11/20/03
- Previous message: Charlie: "Retrieving dynamic web content"
- Next in thread: Mike: "Re: Expect.pm"
- Reply: Mike: "Re: Expect.pm"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 20 Nov 2003 22:20:44 -0000
I'm having a problem in my code where I do an $exp->send($command);
and the next line is an $exp->expect(undef, '-re', $prompt), but the
code continues on without waiting. Anyone have an idea what my
problem is?
The commands are sent and executed, but the command before the 'rm'
is not waited for. The script continues through to the exit.
Mike
# chmod the file
if($opt_s) {
$exp->send("chmod 744 /tmp/$bn\n");
unless($exp->expect(30, '-re', $prompt)) {
warn "timeout waiting for command to return";
}
# is the file there with the right permissions?
$exp->send("ls -l /tmp/$bn\n");
unless($exp->expect(30, '-re', $prompt)) {
warn "timeout waiting for command to return";
}
# execute the file, wait until the command finishes
$exp->send("/tmp/$bn $opt_i\n");
unless($exp->expect(undef, '-re', $prompt)) {
warn "timeout waiting for command to return";
}
$exp->send("rm -f /tmp/$bn\n");
} else {
# execute the command
$exp->send("$opt_c\n");
unless($exp->expect(60, '-re', $shellprompt)) {
warn "timeout waiting for command to return";
}
}
# exit
$exp->send("exit\n");
unless($exp->expect(10, 'onnection closed')) {
warn "timeout waiting for command to return";
$exp->hard_close();
}
$exp->soft_close();
- Previous message: Charlie: "Retrieving dynamic web content"
- Next in thread: Mike: "Re: Expect.pm"
- Reply: Mike: "Re: Expect.pm"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|