how to kill a port's external process?

Garrett G. Hodgson <>
Mon Jul 23 02:56:51 CEST 2001



i'm building a little gui wrapper around a command line audio player.
i've got an erlang process that calls open_port() to spawn the external
player, but it doesn't actually send/receive anything to it over stdio.

when i send the controlling process a stop message, it sends a { self(), close }
message to the port, then receives the {Port, closed} reply and exits.
but the external player doesn't stop playing.  if i kill it from another
window before sending the stop, the controlling process gets the proper
exit_status message, so i know they're connected.  i can even exit erlang
entirely, and it keeps playing until i kill it.

so, is there a clean way to kill this beast?  i can think of some kludgey
ways, like gathering the output of ps and constructing a unix command to 
kill it.  but it seems like there ought to be a better way?  can someone
point me in the right direction?

thanks.


Garry Hodgson                   And when they offer
Senior Hacker                    golden apples
                are you sure you'll refuse?
Software Innovation Services    Heaven help the fool.
AT&T Labs 



More information about the erlang-questions mailing list