[erlang-questions] Exit status of C-port

32 views
Skip to first unread message

Olivier Girondel

unread,
Aug 23, 2012, 11:02:17 AM8/23/12
to erlang-q...@erlang.org
Dear all,

I have a C executable which is run with open_port (spawn_executable,
streaming binary
and getting exit_status)

If/when the C code crashes, I (most of the time) correctly get an exit message
(eg: {exit_status, 134}), which is exactly what I want.

Sometimes though, I get an "exception exit" with the reason "epipe", which means
the port really crashed in a nasty way; but this exception is not catchable.

Apart from doing this another way (-yes, I really do want to
spawn()/run a program that might crash-),
what are the options ?

Thanks,

--
Olivier
_______________________________________________
erlang-questions mailing list
erlang-q...@erlang.org
http://erlang.org/mailman/listinfo/erlang-questions

Jonas Falkevik

unread,
Aug 24, 2012, 4:08:04 PM8/24/12
to Olivier Girondel, erlang-q...@erlang.org
The exception you see might be that you received a exit signal from the port.
Try setting the process flag "trap_exit" to true, then you will exit signal as a message to process linked to the port.

/Jonas

Olivier Girondel

unread,
Aug 25, 2012, 4:21:16 PM8/25/12
to Jonas Falkevik, erlang-q...@erlang.org
On Fri, Aug 24, 2012 at 10:08 PM, Jonas Falkevik
<jonas.f...@mobilearts.com> wrote:
> The exception you see might be that you received a exit signal from the port.
> Try setting the process flag "trap_exit" to true, then you will exit signal as a message to process linked to the port.

/me slaps his head..

Maybe I came back too early from my holidays in the South of France,
sorry for the noise ;)
Reply all
Reply to author
Forward
0 new messages