I have a script which successfully uses Expect.pm to spawn telnet sessions. This works great when run in the foreground - but when in the background the script just dies.
In the following snippet the code always stops just after "AHEAD OF SPAWN".
I guess this is down to IO::TTy and IO::Pty needing a terminal? Can anyone shed any light on this as I dont understand to be even dangerous on this one.
Thanks
Simon
$self->{_logger}->debug("AHEAD OF SPAWN");
eval {
$Spawned = Expect->spawn("$args[0] $args[1]");
$msg = "Spawning to $args[0] $args[1]\n";
$self->{_logger}->info($msg);
};
$self->{_logger}->debug("AFTER OF SPAWN");
Found out that the script doesn't die - it just stops and sits there waiting to be brought into the foreground. When it is - it starts again and picks up normal processing