File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -36,14 +36,13 @@ impl Repl {
36
36
loop {
37
37
print ! ( "{}=> " , self . environment. get_current_namespace_name( ) ) ;
38
38
let _ = io:: stdout ( ) . flush ( ) ;
39
- let mut next = Value :: Nil ;
40
39
41
- // a scope for stdin to be released for providing input for function
42
- {
40
+ let next = {
43
41
let mut stdin_reader = stdin. lock ( ) ;
44
42
// Read
45
- next = Repl :: read ( & mut stdin_reader) ;
46
- }
43
+ Repl :: read ( & mut stdin_reader)
44
+ // Release stdin.lock
45
+ } ;
47
46
48
47
// Eval
49
48
let evaled_next = self . eval ( & next) ;
Original file line number Diff line number Diff line change @@ -22,11 +22,13 @@ impl IFn for ReadLineFn {
22
22
if args. len ( ) != 0 {
23
23
return error_message:: wrong_arg_count ( 0 , args. len ( ) )
24
24
}
25
-
26
25
let mut input = String :: new ( ) ;
27
26
io:: stdout ( ) . flush ( ) ;
28
27
match io:: stdin ( ) . read_line ( & mut input) {
29
- Ok ( _) => Value :: String ( input) ,
28
+ Ok ( _) => {
29
+ input. pop ( ) ;
30
+ Value :: String ( input)
31
+ } ,
30
32
Err ( error) => error_message:: generic_err ( Box :: try_from ( error) . unwrap ( ) )
31
33
}
32
34
}
You can’t perform that action at this time.
0 commit comments