Skip to content

Commit

Permalink
Optimize blank line input case
Browse files Browse the repository at this point in the history
  • Loading branch information
j-devel committed May 14, 2024
1 parent f714088 commit 1e4c8d0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions examples/xbd-net/src/xbd/shell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,18 +75,21 @@ pub async fn process_shell_stream() -> Result<(), i8> {

while let Some(mut line) = stream.next().await {
assert!(line.ends_with("\0"));

println!("[async shell] (null terminated) line: {} (len: {} SHELL_BUFSIZE: {})",
line, line.len(), SHELL_BUFSIZE);
//println!(" line.as_bytes(): {:?}", line.as_bytes());
//println!(" line: {:?}", line);

if match_alias(&mut line) {
assert!(line.ends_with("\0"));
}
if line.trim() != "\0" {
if match_alias(&mut line) {
assert!(line.ends_with("\0"));
}

unsafe { handle_input_line_minerva(shell_commands, line.as_ptr()); }
unsafe { handle_input_line_minerva(shell_commands, line.as_ptr()); }

if 0 == 1 { crate::Xbd::async_sleep(1_000).await; } // debug, ok
if 0 == 1 { crate::Xbd::async_sleep(1_000).await; } // debug, ok
}

prompt();
}
Expand Down

0 comments on commit 1e4c8d0

Please sign in to comment.