File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -821,14 +821,14 @@ fn handle_input_task(tx: Sender<Action>) -> Result<()> {
821821}
822822
823823fn read_stdin_task ( action_tx : Sender < Action > ) -> Result < ( ) > {
824- let mut buff = String :: new ( ) ;
824+ let mut buff = vec ! [ ] ;
825825 let tty = stdin ( ) . is_tty ( ) ;
826826 if !tty {
827- let result = stdin ( ) . read_to_string ( & mut buff) ;
828-
827+ let result = stdin ( ) . read_to_end ( & mut buff) ;
829828 match result {
830829 Ok ( _) => {
831- action_tx. send ( StdinRead ( buff) ) ?;
830+ let content = String :: from_utf8_lossy ( & buff) ;
831+ action_tx. send ( StdinRead ( content. into_owned ( ) ) ) ?;
832832 }
833833 Err ( e) => {
834834 action_tx. send ( StdinReadFailed ( format ! (
@@ -845,10 +845,10 @@ fn read_stdin_task(action_tx: Sender<Action>) -> Result<()> {
845845
846846fn read_file_task ( file : String , action_tx : Sender < Action > ) -> Result < ( ) > {
847847 info ! ( "reading input file {file}" ) ;
848- let file_content = std:: fs:: read_to_string ( file. clone ( ) ) ;
849- match file_content {
848+ match std:: fs:: read ( file. clone ( ) ) {
850849 Ok ( content) => {
851- action_tx. send ( StdinRead ( content) ) ?;
850+ let content = String :: from_utf8_lossy ( & content) ;
851+ action_tx. send ( StdinRead ( content. into_owned ( ) ) ) ?;
852852 }
853853 Err ( e) => {
854854 action_tx. send ( StdinReadFailed ( format ! (
You can’t perform that action at this time.
0 commit comments