feature: basic signal handling
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
#[macro_use]
|
||||
extern crate libusr;
|
||||
|
||||
use libusr::sys::Signal;
|
||||
|
||||
fn readline(fd: i32, buf: &mut [u8]) -> Result<&str, ()> {
|
||||
let count = unsafe { libusr::sys::sys_read(fd, buf) };
|
||||
if count >= 0 {
|
||||
@@ -26,6 +28,14 @@ fn main() -> i32 {
|
||||
|
||||
println!(":: {:?}", line);
|
||||
|
||||
if line == "test" {
|
||||
unsafe {
|
||||
libusr::sys::sys_ex_kill(0, Signal::Interrupt);
|
||||
}
|
||||
trace!("Returned from signal");
|
||||
continue;
|
||||
}
|
||||
|
||||
if line == "quit" || line == "exit" {
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user