Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Re-add support for binding to a specific IP

Accidentally removed support for binding to an IP while trying to clean
up the switch mangling.
  • Loading branch information...
commit 5407f2b058a47b6c6642a2f9aa96468c0217ed64 1 parent b6dadde
@msantos authored
Showing with 11 additions and 2 deletions.
  1. +11 −2 src/procket.erl
View
13 src/procket.erl
@@ -201,11 +201,20 @@ fdget(Socket) ->
fdrecv(S).
make_args(Port, Options) ->
+ Args = reorder_args(Port, Options),
proplists:get_value(progname, Options, "sudo " ++ progname()) ++ " " ++
- string:join([ get_switch(Arg) || Arg <- Options, element(1,Arg) /= ip ], " ") ++
- " " ++ get_switch({port, Port}) ++ get_switch(ip) ++
+ string:join([ get_switch(Arg) || Arg <- Args ], " ") ++
" > /dev/null 2>&1; printf $?".
+reorder_args(Port, Options) ->
+ NewOpts = case proplists:lookup(ip, Options) of
+ none ->
+ Options;
+ IP ->
+ proplists:delete(ip, Options) ++ [IP]
+ end,
+ [{port, Port}] ++ NewOpts.
+
get_switch({pipe, Arg}) ->
"-u " ++ Arg;
Please sign in to comment.
Something went wrong with that request. Please try again.