Skip to content

Commit

Permalink
Merge pull request #23 from JuliaWeb/cmd-env
Browse files Browse the repository at this point in the history
Add some warnings about environment variables when running commands
  • Loading branch information
JamesWrigley authored Oct 16, 2024
2 parents d730a68 + 97e0f8e commit d1da2de
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/channel.jl
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ function _exec_command(process::SshProcess)

if ret != SSH_OK
err = get_error(session)
throw(LibSSHException("Error from lib.ssh_channel_request_env(), could not set environment variable: '$(env_var)'"))
throw(LibSSHException("Error from lib.ssh_channel_request_env(), could not set environment variable '$(env_var)': '$(err)'. Hint: check that the server has an `AcceptEnv` config that allows setting this variable, otherwise it will fail."))
end
end
end
Expand Down Expand Up @@ -580,6 +580,10 @@ supported compared to `run()`:
- Pipelined commands (use a regular pipe like `foo | bar` instead).
- Setting the directory to execute the command in.
!!! note
Setting environment variables is supported, but will fail if the server
forbids setting them.
# Throws
- [`SshProcessFailedException`](@ref): if the command fails and `ignorestatus()`
wasn't used.
Expand Down

0 comments on commit d1da2de

Please sign in to comment.