From: Ken I. <fn...@ua...> - 2007-07-06 14:51:34
|
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... |