Skip to content

Commit 0d9024b

Browse files
committed
Merge branch 'dev' into main
2 parents 29d02e7 + b659f10 commit 0d9024b

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

user/src/bin/user_shell.rs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const DL: u8 = 0x7fu8;
1212
const BS: u8 = 0x08u8;
1313

1414
use alloc::string::String;
15-
use user_lib::{fork, exec, waitpid, yield_};
15+
use user_lib::{fork, exec, waitpid};
1616
use 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
}

0 commit comments

Comments
 (0)