Skip to content

Commit 281f1e8

Browse files
authored
Merge pull request #2 from JuliaWeb/exec
Prepare v0.2.0
2 parents 70cbe87 + a0d0592 commit 281f1e8

File tree

9 files changed

+344
-116
lines changed

9 files changed

+344
-116
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "LibSSH"
22
uuid = "00483490-30f8-4353-8aba-35b82f51f4d0"
33
authors = ["James Wrigley <james@puiterwijk.org> and contributors"]
4-
version = "0.1.0"
4+
version = "0.2.0"
55

66
[deps]
77
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"

docs/src/changelog.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,19 @@
33
This documents notable changes in LibSSH.jl. The format is based on [Keep a
44
Changelog](https://keepachangelog.com).
55

6+
## [v0.2.0] - 2024-02-01
7+
8+
### Changed
9+
10+
- The [Command execution](@ref) API was completely rewritten to match Julia's
11+
API ([#2]). This is a breaking change, any code using the old `ssh.execute()`
12+
will need to be rewritten.
13+
14+
### Fixed
15+
16+
- A cause of segfaults was fixed by storing callbacks properly, so they don't get
17+
garbage collected accidentally ([#2]).
18+
619
## [v0.1.0] - 2024-01-29
720

821
The initial release 🎉 ✨

docs/src/examples.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ ssh.userauth_list(session)
7373
# Now we're authenticated to the server and we can actually do something, like
7474
# running a command:
7575

76-
ssh.execute(session, "echo 'Hello world!'")
76+
@assert read(`echo 'Hello world!'`, session, String) == "Hello world!\n"
7777

7878
# What we get back is a tuple of the return code and the output from the
7979
# command.

docs/src/sessions_and_channels.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,19 @@ You should prefer using these instead of more low-level methods, if you can.
9898

9999
#### Command execution
100100

101+
LibSSH.jl attempts to mimic Julia's API for running local commands with `run()`
102+
etc. But some features are not supported and we attempt to document all of the
103+
differences.
104+
101105
```@docs
102-
execute
106+
SshProcessFailedException
107+
SshProcess
108+
Base.wait(::SshProcess)
109+
Base.success(::SshProcess)
110+
Base.run(::Cmd, ::Session)
111+
Base.read(::Cmd, ::Session)
112+
Base.read(::Cmd, ::Session, ::Type{String})
113+
Base.success(::Cmd, ::Session)
103114
```
104115

105116
#### Direct port forwarding

src/LibSSH.jl

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,27 @@ function lib_version()
158158
VersionNumber(lib.LIBSSH_VERSION_MAJOR, lib.LIBSSH_VERSION_MINOR, lib.LIBSSH_VERSION_MICRO)
159159
end
160160

161+
# Safe wrapper around poll_fd(). There's a race condition in older Julia
162+
# versions between the loop condition evaluation and this line, so we wrap
163+
# poll_fd() in a try-catch in case the bind (and thus the file descriptor) has
164+
# been closed in the meantime, which would cause poll_fd() to throw an IOError:
165+
# https://github.com/JuliaLang/julia/pull/52377
166+
function _safe_poll_fd(args...; kwargs...)
167+
result = nothing
168+
try
169+
result = FileWatching.poll_fd(args...; kwargs...)
170+
catch ex
171+
if !(ex isa Base.IOError)
172+
rethrow()
173+
end
174+
end
175+
176+
return result
177+
end
178+
161179
include("pki.jl")
162-
include("session.jl")
163180
include("callbacks.jl")
181+
include("session.jl")
164182
include("channel.jl")
165183
include("message.jl")
166184
include("server.jl")

0 commit comments

Comments
 (0)