Skip to content

Commit 41bb5fc

Browse files
committed
tmate
1 parent a1b82c7 commit 41bb5fc

3 files changed

Lines changed: 27 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ jobs:
5757
# Cache everything
5858
- uses: julia-actions/cache@v3
5959

60+
# - name: Setup tmate session
61+
# uses: mxschmitt/action-tmate@v3
62+
6063
# Run the tests
6164
- uses: julia-actions/julia-runtest@latest
6265
with:

src/server.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,6 +1250,15 @@ function on_channel_subsystem_request(session, sshchan, subsystem, client)::Bool
12501250
_add_log_event!(client, :channel_subsystem_request, subsystem)
12511251

12521252
if subsystem == "sftp"
1253+
# libssh's SFTP server implementation is guarded by a `#ifndef _WIN32`
1254+
# in src/sftpserver.c, and the Windows stub of
1255+
# sftp_channel_default_data_callback() returns SSH_ERROR for every
1256+
# packet. That means we would never reply to the client's SSH_FXP_INIT
1257+
# and it would block forever in sftp_init(), so fail loudly instead.
1258+
if Sys.iswindows()
1259+
throw(LibSSHException("The Demo server doesn't support SFTP on Windows because libssh doesn't implement the SFTP server API there"))
1260+
end
1261+
12531262
ptr = lib.sftp_server_new(session, sshchan)
12541263
if ptr == C_NULL
12551264
@error "Call to lib.sftp_server_new() failed"

test/LibSSHTests.jl

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -700,9 +700,7 @@ end
700700
@test_throws ssh.SshProcessFailedException run(`foo`, session)
701701

702702
# Test passing a String instead of a Cmd
703-
mktempdir() do tmpdir
704-
@test readchomp("cd $(tmpdir) && pwd", session) == tmpdir
705-
end
703+
@test readchomp("echo foo", session) == "foo"
706704

707705
sshchan = ssh.SshChannel(session)
708706
close(sshchan)
@@ -778,6 +776,15 @@ end
778776
end
779777

780778
@testset "SFTP" begin
779+
if Sys.iswindows()
780+
# libssh doesn't implement the SFTP server API on Windows (the whole
781+
# implementation in src/sftpserver.c is inside a `#ifndef _WIN32`, and the
782+
# Windows stubs return SSH_ERROR unconditionally), so the DemoServer can't
783+
# serve SFTP there and every one of these testsets would hang.
784+
@warn "Skipping SFTP tests on windows"
785+
return
786+
end
787+
781788
@testset "Initialization and finalizing" begin
782789
demo_server_with_session(2222; verbose=false) do session
783790
# session.log_verbosity = ssh.SSH_LOG_TRACE
@@ -1238,6 +1245,11 @@ end
12381245
end
12391246

12401247
@testset "Examples" begin
1248+
# The examples use the SFTP server, which isn't supported on Windows
1249+
if Sys.iswindows()
1250+
return
1251+
end
1252+
12411253
mktempdir() do tempdir
12421254
# Test and generate the examples
12431255
Literate.markdown(joinpath(@__DIR__, "../docs/src/examples.jl"),

0 commit comments

Comments
 (0)