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

TTYSTDError message is incomplete #86

Open
Iomegan opened this issue Nov 14, 2024 · 3 comments
Open

TTYSTDError message is incomplete #86

Iomegan opened this issue Nov 14, 2024 · 3 comments
Assignees

Comments

@Iomegan
Copy link

Iomegan commented Nov 14, 2024

In some cases the TTYSTDError message, seems to only contains the first few bytes.

In my scenario I am trying to send an Apple Script command via SSH like this:
osascript -e 'tell application "Finder" to XYZ'

In the Terminal I get the expected execution error:
29:32: execution error: The variable "XYZ" is not defined. (-2753)

However using Citadel, I only get the first 6 bytes:
29:32:

Code to read the error message:

if let error = error as? TTYSTDError {
                        
    let errorMessage = String(buffer: error.message)
          for byte in error.message.readableBytesView {
               print(byte) // Only 6 bytes...
    }
    print("errorMessage: \(errorMessage)") // 29:32:
}

Both client and server run macOS Sequoia 15.1 (24B83)

@Joannis
Copy link
Member

Joannis commented Nov 19, 2024

Hey @Iomegan can you try the other execute-style methods? For example, the overload with mergeStreams: true? I'm considering deprecating the specific method you're using, since it's proven unwieldy.

@Joannis
Copy link
Member

Joannis commented Nov 19, 2024

withTTY is the most correct variant of this API, but requires a bit more setup for handling streaming messages.

@Iomegan
Copy link
Author

Iomegan commented Nov 19, 2024

If I use execute with mergeStreams: true or mergeStreams: false, I only get a CommandFailed error with exit code 1 as it goes into the other execute function. Only if I do not use execute with the mergeStreams at all, I get the TTYSTDError error.

What kind of setup do you mean?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants