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

PtyCommandLine causes automatic line wrapping, leading to JSON parsing errors #266

Open
kazutoiris opened this issue Jan 4, 2025 · 0 comments · May be fixed by #267
Open

PtyCommandLine causes automatic line wrapping, leading to JSON parsing errors #266

kazutoiris opened this issue Jan 4, 2025 · 0 comments · May be fixed by #267

Comments

@kazutoiris
Copy link

When using PtyCommandLine, unlike GeneralCommandLine, the command output is fully simulated as a TTY. While this simulation enables features such as colored output, it also causes an issue when dealing with long output (currently, lines longer than 80 characters). The text is automatically truncated and wrapped to new lines.

When reading the stdout directly, this causes the output that should not be wrapped into multiple lines to be split, which leads to JSON parsing errors.

Here's an example when compiling a smart contract:

aptos move compile

Although it finishes successfully, it still throws an exception:

{
  "Result": [
    "0000000000000000000000000000000000000000000000000000000000012345::aaa_bbb_c       <-- auto wrapped here
cc_ddd_eee"
  ]
}
com.fasterxml.jackson.core.JsonParseException: Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 3, column: 81]
@kazutoiris kazutoiris linked a pull request Jan 4, 2025 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant