MCPcopy Create free account
hub / github.com/LibertyOS-Development/kernel / readln

Function readln

src/sys/console.rs:419–448  ·  view source on GitHub ↗

Read line

()

Source from the content-addressed store, hash-verified

417
418// Read line
419pub fn readln() -> String
420{
421 loop
422 {
423 crate::time::halt();
424 let res = interrupts::without_interrupts(||
425 {
426 let mut stdin = STDIN.lock();
427 match stdin.chars().next_back()
428 {
429 Some('\n') =>
430 {
431 let ln = stdin.clone();
432 stdin.clear();
433 Some(ln)
434 }
435
436 _ =>
437 {
438 None
439 }
440 }
441 });
442
443 if let Some(ln) = res
444 {
445 return ln;
446 }
447 }
448}

Callers 1

readMethod · 0.85

Calls 2

haltFunction · 0.85
lockMethod · 0.80

Tested by

no test coverage detected