Lisp HUG Maillist Archive

killing process spawned with sys:open-pipe

Hello all,

Has anyone a way to kill a process that was spawned using
sys:open-pipe? System-dependent solutions are OK; I'd be looking for
OS X and Windows solutions, specifically. I know that inspecting the
pipe-stream returned by open-pipe will disclose the pid (on OS X)
which could, I suppose be the argument to a kill via call-system,
though this seems slightly awkward, and HProcess and HThread (on
Windows), but I'm not quite sure what I could do with those yet (I
don't do much in the Windows arena), but there's probably ample
documentation out there. I was just wondering if anyone had already
tackled this problem, or knew of a solution. Thanks in advance!
-- 
=====================
Joshua Taylor
tayloj@rpi.edu

"A lot of good things went down one time,
     back in the goodle days."
               John Hartford


RE: killing process spawned with sys:open-pipe

 

> -----Original Message-----
> From: owner-lisp-hug@lispworks.com 
> [mailto:owner-lisp-hug@lispworks.com] On Behalf Of Taylor, Joshua
> Sent: Thursday, April 05, 2007 8:02 PM
> To: Lispworks HUG
> Subject: killing process spawned with sys:open-pipe
> 
> Has anyone a way to kill a process that was spawned using 
> sys:open-pipe? 

On Windows you can use:

(fli:define-foreign-function (terminate-process "TerminateProcess")
((hprocess :int)
(exitvalue :int))
:result-type :int)

Then, given the process handle, 

(terminate-process hprocess 1)

will terminate the process and tell any process that asks that the exit value of the process was 1. The process is not notified and gets no chance to clean up anything, so this is a last-resort mechanism. 

(Windows has lots of ways of signalling from one process to another, so if you can tell it to exit gracefully, you should. But you'd need to program the other process yourself, or at least know that the programmer has included some mechanism for doing that.)



Eivind


Why no closures in the Definitions tab?

How come closures don't appear in the Definitions tab?

Mitch


Updated at: 2020-12-10 08:46 UTC