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

Fixed readme description change TTYStdinWriter.ChangeSize function #85

Merged
merged 1 commit into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,29 @@ while let blob = try await asyncStreams.next() {
}
```

Citadel currently does not expose APIs for streaming into a process' `stdin`. If you want this, please create an issue.
Citadel currently expose APIs for streaming into a process' `stdin`. only withPTY and withTTY.

An example of how pty model can be used:

```swift
try await client.withPTY(
SSHChannelRequestEvent.PseudoTerminalRequest(
wantReply: true,
term: "xterm",
terminalCharacterWidth: 80,
terminalRowHeight: 24,
terminalPixelWidth: 0,
terminalPixelHeight: 0,
terminalModes: .init([.ECHO: 1])
),
environment: [SSHChannelRequestEvent.EnvironmentRequest(wantReply: true, name: "LANG", value: "en_US.UTF-8")]) {

ttyOutput, ttyStdinWriter in

...do something...
}
```


### SFTP Client

Expand Down
10 changes: 5 additions & 5 deletions Sources/Citadel/TTY/Client/TTY.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ public struct TTYStdinWriter {
try await channel.writeAndFlush(SSHChannelData(type: .channel, data: .byteBuffer(buffer)))
}

public func changeSize(cols: Int, rows: Int) async throws {
public func changeSize(cols: Int, rows: Int, pixelWidth:Int, pixelHeight:Int) async throws {
try await channel.triggerUserOutboundEvent(
SSHChannelRequestEvent.WindowChangeRequest(
terminalCharacterWidth: 0,
terminalRowHeight: 0,
terminalPixelWidth: 0,
terminalPixelHeight: 0
terminalCharacterWidth: cols,
terminalRowHeight: rows,
terminalPixelWidth: pixelWidth,
terminalPixelHeight: pixelHeight
)
)
}
Expand Down
Loading