aboutsummaryrefslogtreecommitdiffstats
path: root/lib/kernel
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2011-03-02 12:00:19 +0100
committerSverker Eriksson <[email protected]>2011-03-02 12:00:19 +0100
commitbe3218dc1bf7dec1217bcac82492a5550da7ee17 (patch)
tree5f0c14e868666c0c6415f6040966e68c8c94b7d1 /lib/kernel
parente83fc28ced34c954f65eaa884e093fdd733f8992 (diff)
downloadotp-be3218dc1bf7dec1217bcac82492a5550da7ee17.tar.gz
otp-be3218dc1bf7dec1217bcac82492a5550da7ee17.tar.bz2
otp-be3218dc1bf7dec1217bcac82492a5550da7ee17.zip
Fix dialyzer warning in os:start_port_srv_loop
Rewrote the code a bit to silence dialyzer. Seems dialyzer can't handle a function that either returns or loops forever depending on function argument.
Diffstat (limited to 'lib/kernel')
-rw-r--r--lib/kernel/src/os.erl24
1 files changed, 13 insertions, 11 deletions
diff --git a/lib/kernel/src/os.erl b/lib/kernel/src/os.erl
index ce8c581e08..95a2f71ec0 100644
--- a/lib/kernel/src/os.erl
+++ b/lib/kernel/src/os.erl
@@ -231,9 +231,13 @@ start_port_srv(Request) ->
catch
error:_ -> false
end,
- start_port_srv_loop(Request, StayAlive).
+ start_port_srv_handle(Request),
+ case StayAlive of
+ true -> start_port_srv_loop();
+ false -> exiting
+ end.
-start_port_srv_loop({Ref,Client}, StayAlive) ->
+start_port_srv_handle({Ref,Client}) ->
Reply = try open_port({spawn, ?SHELL},[stream]) of
Port when is_port(Port) ->
(catch port_connect(Port, Client)),
@@ -243,20 +247,18 @@ start_port_srv_loop({Ref,Client}, StayAlive) ->
error:Reason ->
{Reason,erlang:get_stacktrace()}
end,
- Client ! {Ref,Reply},
- case StayAlive of
- true -> start_port_srv_loop(get_open_port_request(), true);
- false -> exiting
- end.
+ Client ! {Ref,Reply}.
-get_open_port_request() ->
+
+start_port_srv_loop() ->
receive
{Ref, Client} = Request when is_reference(Ref),
is_pid(Client) ->
- Request;
+ start_port_srv_handle(Request);
_Junk ->
- get_open_port_request()
- end.
+ ignore
+ end,
+ start_port_srv_loop().
%%
%% unix_get_data(Port) -> Result