Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
81705bb
commit b562288
Showing
12 changed files
with
148 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"cli.rs": patch | ||
"cli.js": patch | ||
--- | ||
|
||
Exit CLI when Cargo returns a non-compilation error in `tauri dev`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
"tauri": patch | ||
"api": patch | ||
--- | ||
|
||
**Breaking change:** The process Command API stdio lines now includes the trailing `\r`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"tauri-utils": patch | ||
--- | ||
|
||
Added the `io` module with the `read_line` method. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-License-Identifier: MIT | ||
|
||
//! IO helpers. | ||
|
||
use std::io::BufRead; | ||
|
||
/// Read a line breaking in both \n and \r. | ||
/// | ||
/// Adapted from https://doc.rust-lang.org/std/io/trait.BufRead.html#method.read_line | ||
pub fn read_line<R: BufRead + ?Sized>(r: &mut R, buf: &mut Vec<u8>) -> std::io::Result<usize> { | ||
let mut read = 0; | ||
loop { | ||
let (done, used) = { | ||
let available = match r.fill_buf() { | ||
Ok(n) => n, | ||
Err(ref e) if e.kind() == std::io::ErrorKind::Interrupted => continue, | ||
Err(e) => return Err(e), | ||
}; | ||
match memchr::memchr(b'\n', available) { | ||
Some(i) => { | ||
let end = i + 1; | ||
buf.extend_from_slice(&available[..end]); | ||
(true, end) | ||
} | ||
None => match memchr::memchr(b'\r', available) { | ||
Some(i) => { | ||
let end = i + 1; | ||
buf.extend_from_slice(&available[..end]); | ||
(true, end) | ||
} | ||
None => { | ||
buf.extend_from_slice(available); | ||
(false, available.len()) | ||
} | ||
}, | ||
} | ||
}; | ||
r.consume(used); | ||
read += used; | ||
if done || used == 0 { | ||
if buf.ends_with(&[b'\n']) { | ||
buf.pop(); | ||
} | ||
return Ok(read); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters