File tree Expand file tree Collapse file tree 3 files changed +35
-16
lines changed
Expand file tree Collapse file tree 3 files changed +35
-16
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " @tauri-apps/cli " : patch:bug
3+ " tauri-cli " : patch:bug
4+ " tauri-bundler " : patch:bug
5+ ---
6+
7+ Fixes errors on command output, occuring when the output stream contains an invalid UTF-8 character, or ends with a multi-bytes UTF-8 character.
Original file line number Diff line number Diff line change @@ -169,11 +169,14 @@ impl CommandExt for Command {
169169 let mut lines = stdout_lines_. lock ( ) . unwrap ( ) ;
170170 loop {
171171 line. clear ( ) ;
172- if let Ok ( 0 ) = stdout. read_line ( & mut line) {
173- break ;
172+ match stdout. read_line ( & mut line) {
173+ Ok ( 0 ) => break ,
174+ Ok ( _) => {
175+ debug ! ( action = "stdout" ; "{}" , line. trim_end( ) ) ;
176+ lines. extend ( line. as_bytes ( ) . to_vec ( ) ) ;
177+ }
178+ Err ( _) => ( ) ,
174179 }
175- debug ! ( action = "stdout" ; "{}" , & line[ 0 ..line. len( ) - 1 ] ) ;
176- lines. extend ( line. as_bytes ( ) . to_vec ( ) ) ;
177180 }
178181 } ) ;
179182
@@ -185,11 +188,14 @@ impl CommandExt for Command {
185188 let mut lines = stderr_lines_. lock ( ) . unwrap ( ) ;
186189 loop {
187190 line. clear ( ) ;
188- if let Ok ( 0 ) = stderr. read_line ( & mut line) {
189- break ;
191+ match stderr. read_line ( & mut line) {
192+ Ok ( 0 ) => break ,
193+ Ok ( _) => {
194+ debug ! ( action = "stderr" ; "{}" , line. trim_end( ) ) ;
195+ lines. extend ( line. as_bytes ( ) . to_vec ( ) ) ;
196+ }
197+ Err ( _) => ( ) ,
190198 }
191- debug ! ( action = "stderr" ; "{}" , & line[ 0 ..line. len( ) - 1 ] ) ;
192- lines. extend ( line. as_bytes ( ) . to_vec ( ) ) ;
193199 }
194200 } ) ;
195201
Original file line number Diff line number Diff line change @@ -231,11 +231,14 @@ impl CommandExt for Command {
231231 let mut lines = stdout_lines_. lock ( ) . unwrap ( ) ;
232232 loop {
233233 line. clear ( ) ;
234- if let Ok ( 0 ) = stdout. read_line ( & mut line) {
235- break ;
234+ match stdout. read_line ( & mut line) {
235+ Ok ( 0 ) => break ,
236+ Ok ( _) => {
237+ debug ! ( action = "stdout" ; "{}" , line. trim_end( ) ) ;
238+ lines. extend ( line. as_bytes ( ) . to_vec ( ) ) ;
239+ }
240+ Err ( _) => ( ) ,
236241 }
237- debug ! ( action = "stdout" ; "{}" , & line[ 0 ..line. len( ) - 1 ] ) ;
238- lines. extend ( line. as_bytes ( ) . to_vec ( ) ) ;
239242 }
240243 } ) ;
241244
@@ -247,11 +250,14 @@ impl CommandExt for Command {
247250 let mut lines = stderr_lines_. lock ( ) . unwrap ( ) ;
248251 loop {
249252 line. clear ( ) ;
250- if let Ok ( 0 ) = stderr. read_line ( & mut line) {
251- break ;
253+ match stderr. read_line ( & mut line) {
254+ Ok ( 0 ) => break ,
255+ Ok ( _) => {
256+ debug ! ( action = "stderr" ; "{}" , line. trim_end( ) ) ;
257+ lines. extend ( line. as_bytes ( ) . to_vec ( ) ) ;
258+ }
259+ Err ( _) => ( ) ,
252260 }
253- debug ! ( action = "stderr" ; "{}" , & line[ 0 ..line. len( ) - 1 ] ) ;
254- lines. extend ( line. as_bytes ( ) . to_vec ( ) ) ;
255261 }
256262 } ) ;
257263
You can’t perform that action at this time.
0 commit comments