File tree 1 file changed +7
-9
lines changed 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change @@ -583,28 +583,26 @@ fn run_shell(vm: &VirtualMachine, scope: Scope) -> PyResult<()> {
583
583
use std:: io:: { self , BufRead , Write } ;
584
584
585
585
println ! (
586
- "Welcome to the magnificent Rust Python {} interpreter \u{1f631} \u{1f596} " ,
586
+ "Welcome to the magnificent Rust Python {} interpreter! " ,
587
587
crate_version!( )
588
588
) ;
589
589
590
- let stdin = io:: stdin ( ) ;
591
- let stdout = io:: stdout ( ) ;
592
- let mut stdout = stdout. lock ( ) ;
593
-
594
- let mut print_prompt = || {
590
+ fn print_prompt ( ) {
595
591
let prompt = get_prompt ( vm, "ps1" ) ;
596
592
let prompt = match prompt {
597
593
Some ( ref s) => s. as_str ( ) ,
598
594
None => "" ,
599
595
} ;
600
596
print ! ( "{}" , prompt) ;
601
- stdout. flush ( ) . expect ( "flush failed" ) ;
602
- } ;
597
+ io:: stdout ( ) . lock ( ) . flush ( ) . expect ( "flush failed" ) ;
598
+ }
599
+
600
+ let stdin = io:: stdin ( ) ;
603
601
604
602
print_prompt ( ) ;
605
603
for line in stdin. lock ( ) . lines ( ) {
606
604
let mut line = line. expect ( "line failed" ) ;
607
- line. push ( '\n' ) ;
605
+ line. push_str ( " \n " ) ;
608
606
match shell_exec ( vm, & line, scope. clone ( ) ) {
609
607
ShellExecResult :: Ok => { }
610
608
ShellExecResult :: Continue => println ! ( "Unexpected EOF" ) ,
You can’t perform that action at this time.
0 commit comments