how to kill a port's external process?

Garry Hodgson <>
Thu Aug 9 19:54:06 CEST 2001

Chris Pressey wrote:

> "Garrett G. Hodgson" wrote:
> > 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.
> I don't think the port mechanism was ever intended to be used that way
> :)

yeah, well, i live to abuse language features.


> So the port terminates when the read_cmd() function detects end-of-file
> from the Erlang side of things (AFAICT.)
> Do you have the source to the external program?  It might help to
> rewrite the main body to listen to the Erlang ports mechanism, even if
> there's no established interface.

alas, i do not.

> This goes beyond Erlang, but... killing a process based on the name
> of a program is always dodgy at best, given that a program can change
> what it shows up as in 'ps'. 

in this case, the external program does not.  i've gotten it working
using this hack, and it works just fine for my purposes.  i expect i'll
let it be.

thanks to all for the information and tips.

Garry Hodgson                   sometimes we ride on your horses
Senior Hacker                   sometimes we walk alone
Software Innovation Services    sometimes the songs that we hear
AT&T Labs                       are just songs of our own

More information about the erlang-questions mailing list