Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WinSSH: Send eof to let server know we're done #12463

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 4 additions & 1 deletion plugins/communicators/winssh/communicator.rb
Expand Up @@ -44,7 +44,7 @@ def shell_execute(connection, command, **opts)
stderr_data_buffer = ''

@logger.debug("Base SSH exec command: #{command}")
command = "$ProgressPreference = 'SilentlyContinue';Write-Output #{CMD_GARBAGE_MARKER};[Console]::Error.WriteLine('#{CMD_GARBAGE_MARKER}');#{command}"
command = "$ProgressPreference = 'SilentlyContinue';Write-Output #{CMD_GARBAGE_MARKER};[Console]::Error.WriteLine('#{CMD_GARBAGE_MARKER}');#{command};$?"

ch.exec(command) do |ch2, _|
# Setup the channel callbacks so we can get data and exit status
Expand Down Expand Up @@ -96,6 +96,9 @@ def shell_execute(connection, command, **opts)
# probably done. This fixes up issues with hanging.
ch.close
end

# Send eof to let server know we're done
ch2.eof!

end
end
Expand Down