From b246e47d53d4b738fe47df1d7bf71138a8501e02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johannes=20Wei=C3=9Fl?= Date: Mon, 27 Jan 2014 00:43:00 +0100 Subject: ssh: Fix dialyzer type specs and documentation Similar to d9ebfb8. The wrong specs were leading to dialyzer warnings like this in our application since R16B03: The pattern 'ok' can never match the type {'error',_}. The pattern {'error', {'already_started', 'ssh'}} can never match the type 'ok'. The pattern {'error', _} can never match the type {'open_error',_,string(),string()}. --- lib/ssh/doc/src/ssh.xml | 5 ++++- lib/ssh/src/ssh.erl | 6 +++--- lib/ssh/src/ssh_connection_handler.erl | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) (limited to 'lib/ssh') diff --git a/lib/ssh/doc/src/ssh.xml b/lib/ssh/doc/src/ssh.xml index c1a51d57fc..3a16eb29fa 100644 --- a/lib/ssh/doc/src/ssh.xml +++ b/lib/ssh/doc/src/ssh.xml @@ -365,8 +365,11 @@ - stop() -> ok + stop() -> ok | {error, Reason} Stops the SSH application. + + Reason = term() +

Stops the SSH application. See also application(3)

diff --git a/lib/ssh/src/ssh.erl b/lib/ssh/src/ssh.erl index 2685b1553b..891f9cc030 100644 --- a/lib/ssh/src/ssh.erl +++ b/lib/ssh/src/ssh.erl @@ -32,8 +32,8 @@ shell/1, shell/2, shell/3]). %%-------------------------------------------------------------------- --spec start() -> ok. --spec start(permanent | transient | temporary) -> ok. +-spec start() -> ok | {error, term()}. +-spec start(permanent | transient | temporary) -> ok | {error, term()}. %% %% Description: Starts the ssh application. Default type %% is temporary. see application(3) @@ -51,7 +51,7 @@ start(Type) -> application:start(ssh, Type). %%-------------------------------------------------------------------- --spec stop() -> ok. +-spec stop() -> ok | {error, term()}. %% %% Description: Stops the ssh application. %%-------------------------------------------------------------------- diff --git a/lib/ssh/src/ssh_connection_handler.erl b/lib/ssh/src/ssh_connection_handler.erl index 3462b98172..070a2db5a8 100644 --- a/lib/ssh/src/ssh_connection_handler.erl +++ b/lib/ssh/src/ssh_connection_handler.erl @@ -157,7 +157,7 @@ init([Role, Socket, SshOpts]) -> %%-------------------------------------------------------------------- -spec open_channel(pid(), string(), iodata(), integer(), integer(), - timeout()) -> {open, channel_id()} | {open_error, term(), string(), string()}. + timeout()) -> {open, channel_id()} | {error, term()}. %%-------------------------------------------------------------------- open_channel(ConnectionHandler, ChannelType, ChannelSpecificData, InitialWindowSize, -- cgit v1.2.3