File tree 1 file changed +9
-10
lines changed 1 file changed +9
-10
lines changed Original file line number Diff line number Diff line change @@ -126,14 +126,16 @@ fn read_until_empty_line(input: &mut String) -> Result<i32, std::io::Error> {
126
126
io:: stdout ( ) . flush ( ) . expect ( "Could not flush stdout" ) ;
127
127
let mut line = String :: new ( ) ;
128
128
match io:: stdin ( ) . read_line ( & mut line) {
129
- Ok ( 0 ) => {
130
- return Ok ( 0 ) ;
131
- }
132
- Ok ( 1 ) => {
133
- return Ok ( 1 ) ;
134
- }
135
129
Ok ( _) => {
136
- input. push_str ( & line) ;
130
+ line = line
131
+ . trim_right_matches ( |c| c == '\r' || c == '\n' )
132
+ . to_string ( ) ;
133
+ if line. len ( ) == 0 {
134
+ return Ok ( 0 ) ; // DOne
135
+ } else {
136
+ input. push_str ( & line) ;
137
+ input. push_str ( "\n " ) ;
138
+ }
137
139
}
138
140
Err ( msg) => {
139
141
return Err ( msg) ;
@@ -167,9 +169,6 @@ fn run_shell() {
167
169
input = String :: new ( ) ;
168
170
} else {
169
171
match read_until_empty_line ( & mut input) {
170
- Ok ( 0 ) => {
171
- break ;
172
- }
173
172
Ok ( _) => {
174
173
shell_exec ( & mut vm, & input, vars. clone ( ) ) ;
175
174
}
You can’t perform that action at this time.
0 commit comments