Skip to content

Commit

Permalink
Merge pull request #2 from JuliaWeb/exec
Browse files Browse the repository at this point in the history
Prepare v0.2.0
  • Loading branch information
JamesWrigley authored Feb 2, 2024
2 parents 70cbe87 + a0d0592 commit 281f1e8
Show file tree
Hide file tree
Showing 9 changed files with 344 additions and 116 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "LibSSH"
uuid = "00483490-30f8-4353-8aba-35b82f51f4d0"
authors = ["James Wrigley <[email protected]> and contributors"]
version = "0.1.0"
version = "0.2.0"

[deps]
CEnum = "fa961155-64e5-5f13-b03f-caf6b980ea82"
Expand Down
13 changes: 13 additions & 0 deletions docs/src/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@
This documents notable changes in LibSSH.jl. The format is based on [Keep a
Changelog](https://keepachangelog.com).

## [v0.2.0] - 2024-02-01

### Changed

- The [Command execution](@ref) API was completely rewritten to match Julia's
API ([#2]). This is a breaking change, any code using the old `ssh.execute()`
will need to be rewritten.

### Fixed

- A cause of segfaults was fixed by storing callbacks properly, so they don't get
garbage collected accidentally ([#2]).

## [v0.1.0] - 2024-01-29

The initial release 🎉 ✨
Expand Down
2 changes: 1 addition & 1 deletion docs/src/examples.jl
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ ssh.userauth_list(session)
# Now we're authenticated to the server and we can actually do something, like
# running a command:

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

# What we get back is a tuple of the return code and the output from the
# command.
Expand Down
13 changes: 12 additions & 1 deletion docs/src/sessions_and_channels.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,19 @@ You should prefer using these instead of more low-level methods, if you can.

#### Command execution

LibSSH.jl attempts to mimic Julia's API for running local commands with `run()`
etc. But some features are not supported and we attempt to document all of the
differences.

```@docs
execute
SshProcessFailedException
SshProcess
Base.wait(::SshProcess)
Base.success(::SshProcess)
Base.run(::Cmd, ::Session)
Base.read(::Cmd, ::Session)
Base.read(::Cmd, ::Session, ::Type{String})
Base.success(::Cmd, ::Session)
```

#### Direct port forwarding
Expand Down
20 changes: 19 additions & 1 deletion src/LibSSH.jl
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,27 @@ function lib_version()
VersionNumber(lib.LIBSSH_VERSION_MAJOR, lib.LIBSSH_VERSION_MINOR, lib.LIBSSH_VERSION_MICRO)
end

# Safe wrapper around poll_fd(). There's a race condition in older Julia
# versions between the loop condition evaluation and this line, so we wrap
# poll_fd() in a try-catch in case the bind (and thus the file descriptor) has
# been closed in the meantime, which would cause poll_fd() to throw an IOError:
# https://github.com/JuliaLang/julia/pull/52377
function _safe_poll_fd(args...; kwargs...)
result = nothing
try
result = FileWatching.poll_fd(args...; kwargs...)
catch ex
if !(ex isa Base.IOError)
rethrow()
end
end

return result
end

include("pki.jl")
include("session.jl")
include("callbacks.jl")
include("session.jl")
include("channel.jl")
include("message.jl")
include("server.jl")
Expand Down
Loading

2 comments on commit 281f1e8

@JamesWrigley
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/100142

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.0 -m "<description of version>" 281f1e85f9cfb9ecbdb60c4bcb917beb9ef844a1
git push origin v0.2.0

Please sign in to comment.