elib/port_wrapper.erl in mojombo-ernie-0.2.0 vs elib/port_wrapper.erl in mojombo-ernie-0.3.0
- old
+ new
@@ -1,7 +1,7 @@
-module(port_wrapper).
--export([wrap/1, wrap/2, wrap_link/1, wrap_link/2, send/2, shutdown/1, rpc/2]).
+-export([wrap/1, wrap/2, wrap_link/1, wrap_link/2, send/2, shutdown/1, close/1, rpc/2]).
wrap(Command) ->
spawn(fun() -> process_flag(trap_exit, true), Port = create_port(Command), loop(Port, infinity, Command) end).
wrap(Command, Timeout) ->
spawn(fun() -> process_flag(trap_exit, true), Port = create_port(Command), loop(Port, Timeout, Command) end).
@@ -23,9 +23,13 @@
WrappedPort ! {self(), {command, Message}},
WrappedPort.
shutdown(WrappedPort) ->
WrappedPort ! shutdown,
+ true.
+
+close(WrappedPort) ->
+ WrappedPort ! noose,
true.
create_port(Command) ->
open_port({spawn, Command}, [{packet, 4}, nouse_stdio, exit_status, binary]).
\ No newline at end of file