skunkwerks / swirl

[alpha] IETF PPSP RFC7574 in Erlang/OTP -- an incomplete non-functional partial implementation
http://www.swirl-project.org/
Apache License 2.0
175 stars 13 forks source link

Handle case when id application env key is not set #40

Closed kxepal closed 9 years ago

kxepal commented 9 years ago

Need to note, that badmatch seems happens only for escript. swirl:start() in shell fetches version correctly.

dch commented 9 years ago

Thanks! git bisect says I broke it here 9f0df1b. I'd like to have the escript version print out correctly too, wonder what changed.

dch commented 9 years ago

Aha. It's because swirl:start() doesn't return successfully under escript. Digging further after a sunshine break.

=INFO REPORT==== 18-Jul-2015::16:44:00 ===
swirl: version #decf90c-dirty
escript: exception error: no match of right hand side value ok
  in function  swirl:main/1 (src/swirl.erl, line 230)
dch commented 9 years ago

Oops I changed the return code of swirl:start() for a simple ok. Here's a simpler fix:

%% for escript support
-spec main(any()) -> no_return().
main(_) ->
    ok = start(),
    {ok, _ } = start_peer(),
    timer:sleep(infinity).

The help text isnt useful anyway as there's no terminal support.