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

fix(tauri-utils): include \n in io::read_line, closes #6388 #6519

Merged
merged 8 commits into from
Aug 8, 2023

Conversation

amrbashir
Copy link
Member

@amrbashir amrbashir commented Mar 21, 2023

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Docs
  • New Binding issue #___
  • Code style update
  • Refactor
  • Build-related changes
  • Other, please describe:

Does this PR introduce a breaking change?

  • Yes, and the changes were approved in issue #___
  • No

Checklist

  • When resolving issues, they are referenced in the PR's title (e.g fix: remove a typo, closes #___, #___)
  • A change file is added if any packages will require a version bump due to this PR per the instructions in the readme.
  • I have added a convincing reason for adding this feature, if necessary

Other information

@amrbashir amrbashir requested a review from a team as a code owner March 21, 2023 17:46
@amrbashir amrbashir changed the base branch from dev to 1.x July 4, 2023 14:11
@amrbashir amrbashir added the status: needs review A maintainer must review this code label Jul 4, 2023
@lucasfernog
Copy link
Member

I see the value of keeping this compatible with the Rust std library, but I worry this is a breaking change for some users. Maybe we could target this for v2 instead.

The use case of the issue is also a little weird ( but I need to know if that newline character was present or not in the stdout.). If there's no newline or \r in the output, Tauri will keep waiting for it to appear and never give the bytes to the user, so he will end up not knowing this anyway.

Currently if the line does not end with \r, then you're sure it ends with \n and can append it on your end.

@amrbashir
Copy link
Member Author

I see the value of keeping this compatible with the Rust std library, but I worry this is a breaking change for some users. Maybe we could target this for v2 instead.

tbh I see it as a bug fix so not a breaking change

The use case of the issue is also a little weird ( but I need to know if that newline character was present or not in the stdout.). If there's no newline or \r in the output, Tauri will keep waiting for it to appear and never give the bytes to the user, so he will end up not knowing this anyway.

Currently if the line does not end with \r, then you're sure it ends with \n and can append it on your end.

While that maybe true, it is a bad DX (showcased in the example you added) and beside the use case of the issue, unix and windows had different behaviors which needs to align and if you align any of them to the other it will break for some users so I'd rather just fix the buggy behavior and align with rust.

@lucasfernog lucasfernog merged commit a6b52e4 into 1.x Aug 8, 2023
@lucasfernog lucasfernog deleted the fix/tauri-utils/read_line branch August 8, 2023 19:43
amrbashir added a commit that referenced this pull request May 8, 2024
The speed gains comes from running the Command in Rust fully and returning the result in one go instead of using events.

The extra new lines was a regression from #6519

ref: #7684 (comment)
amrbashir added a commit to tauri-apps/plugins-workspace that referenced this pull request May 8, 2024
The speed gains comes from running the Command in Rust fully and returning the result in one go instead of using events.

The extra new lines was a regression from tauri-apps/tauri#6519
ref: tauri-apps/tauri#7684 (comment)
amrbashir added a commit that referenced this pull request May 9, 2024
* fix(core/shell): speedup `Command.execute` & fix extra new lines

The speed gains comes from running the Command in Rust fully and returning the result in one go instead of using events.

The extra new lines was a regression from #6519

ref: #7684 (comment)

* fix unix build

* clippy

* cleanup

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
amrbashir added a commit to tauri-apps/plugins-workspace that referenced this pull request May 9, 2024
* fix(core/shell): speedup `Command.execute` & fix extra new lines

The speed gains comes from running the Command in Rust fully and returning the result in one go instead of using events.

The extra new lines was a regression from tauri-apps/tauri#6519
ref: tauri-apps/tauri#7684 (comment)

* fmt

* dedup code
tauri-bot pushed a commit to tauri-apps/tauri-plugin-shell that referenced this pull request May 9, 2024
* fix(core/shell): speedup `Command.execute` & fix extra new lines

The speed gains comes from running the Command in Rust fully and returning the result in one go instead of using events.

The extra new lines was a regression from tauri-apps/tauri#6519
ref: tauri-apps/tauri#7684 (comment)

* fmt

* dedup code

Committed via a GitHub action: https://github.com/tauri-apps/plugins-workspace/actions/runs/9019432546

Co-authored-by: amrbashir <amrbashir@users.noreply.github.com>
amrbashir added a commit that referenced this pull request May 15, 2024
* fix(core/shell): speedup `Command.execute` & fix extra new lines

The speed gains comes from running the Command in Rust fully and returning the result in one go instead of using events.

The extra new lines was a regression from #6519

ref: #7684 (comment)

* fix unix build

* clippy

* cleanup

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
lucasfernog added a commit that referenced this pull request May 24, 2024
* fix(core/shell): speedup `Command.execute` & fix extra new lines (#9706)

* fix(core/shell): speedup `Command.execute` & fix extra new lines

The speed gains comes from running the Command in Rust fully and returning the result in one go instead of using events.

The extra new lines was a regression from #6519

ref: #7684 (comment)

* fix unix build

* clippy

* cleanup

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>

* lock file

* minor

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: needs review A maintainer must review this code
Projects
Status: 🔎 In audit
Development

Successfully merging this pull request may close these issues.

2 participants