File tree Expand file tree Collapse file tree 1 file changed +5
-13
lines changed Expand file tree Collapse file tree 1 file changed +5
-13
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ const DL: u8 = 0x7fu8;
1212const BS : u8 = 0x08u8 ;
1313
1414use alloc:: string:: String ;
15- use user_lib:: { fork, exec, waitpid, yield_ } ;
15+ use user_lib:: { fork, exec, waitpid} ;
1616use user_lib:: console:: getchar;
1717
1818#[ no_mangle]
@@ -36,18 +36,10 @@ pub fn main() -> i32 {
3636 }
3737 unreachable ! ( ) ;
3838 } else {
39- let mut xstate: i32 = 0 ;
40- let mut exit_pid: isize ;
41- loop {
42- exit_pid = waitpid ( pid as usize , & mut xstate) ;
43- if exit_pid == -1 {
44- yield_ ( ) ;
45- } else {
46- assert_eq ! ( pid, exit_pid) ;
47- println ! ( "Shell: Process {} exited with code {}" , pid, xstate) ;
48- break ;
49- }
50- }
39+ let mut exit_code: i32 = 0 ;
40+ let exit_pid = waitpid ( pid as usize , & mut exit_code) ;
41+ assert_eq ! ( pid, exit_pid) ;
42+ println ! ( "Shell: Process {} exited with code {}" , pid, exit_code) ;
5143 }
5244 line. clear ( ) ;
5345 }
You can’t perform that action at this time.
0 commit comments