From: Bruno N. <bn...@gm...> - 2007-07-06 14:59:38
|
Why don't you add a signal handler to your perl script that when it receives the CTRL-C it calls the $exp->hard_close(); on the spawned expect object? regards, bruno On 7/6/07, Ken Irving <fn...@ua...> wrote: > On Thu, Jul 05, 2007 at 12:26:20AM -0700, markgo wrote: > > > > Hi, > > > > In some script I'm sending the command that runs some tool that could only > > be stopped by pressing Ctrl-C. It does not wait for any input. Is there any > > way to simulate this Ctrl-C (that is SIGINT) except closing the session? > > > > Currently it looks like that: > > > > $session = new Expect; > > $session->spawn("su - $user_name") or die "..."; # Script runs as root > > $session->expect(....); > > ... > > > > $session->send("sudo $tool"); > > > > ... > > > > This is a tool I'd like to interrupt. > > > > $session->send("\cC") does not work, I suppose because the tool is not > > waiting for input. > > > > Thank you, > > Mark > > Why not just send the signal directly to the process: > > kill SIGINT $tool_pid; > > Ken > > -- > Ken Irving, fn...@ua... > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Expectperl-discuss mailing list > Exp...@li... > https://lists.sourceforge.net/lists/listinfo/expectperl-discuss > |