File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -36,14 +36,13 @@ impl Repl {
3636 loop {
3737 print ! ( "{}=> " , self . environment. get_current_namespace_name( ) ) ;
3838 let _ = io:: stdout ( ) . flush ( ) ;
39- let mut next = Value :: Nil ;
4039
41- // a scope for stdin to be released for providing input for function
42- {
40+ let next = {
4341 let mut stdin_reader = stdin. lock ( ) ;
4442 // Read
45- next = Repl :: read ( & mut stdin_reader) ;
46- }
43+ Repl :: read ( & mut stdin_reader)
44+ // Release stdin.lock
45+ } ;
4746
4847 // Eval
4948 let evaled_next = self . eval ( & next) ;
Original file line number Diff line number Diff line change @@ -22,11 +22,13 @@ impl IFn for ReadLineFn {
2222 if args. len ( ) != 0 {
2323 return error_message:: wrong_arg_count ( 0 , args. len ( ) )
2424 }
25-
2625 let mut input = String :: new ( ) ;
2726 io:: stdout ( ) . flush ( ) ;
2827 match io:: stdin ( ) . read_line ( & mut input) {
29- Ok ( _) => Value :: String ( input) ,
28+ Ok ( _) => {
29+ input. pop ( ) ;
30+ Value :: String ( input)
31+ } ,
3032 Err ( error) => error_message:: generic_err ( Box :: try_from ( error) . unwrap ( ) )
3133 }
3234 }
You can’t perform that action at this time.
0 commit comments