Skip to content

Kernel targets print extraneous shell prompt at end #108

@danobi

Description

@danobi
$ ./target/debug/vmtest -k tests/.assets/bzImage-v6.2-empty ls
=> bzImage-v6.2-empty
===> Booting
===> Setting up VM
===> Running command
Cargo.lock
Cargo.toml
docs
LICENSE
Makefile
README.md
scripts
src
target
tests
vmtest.toml
[root@(none) /]#

Note the [root@(none) /]# at the end.

I think it happens b/c of the login terminal in init.sh:

setsid --ctty --wait /bin/bash --login

Not sure the best way to suppress that prompt. One option is to use templating engine to ifdef the login shell out. But it'd be preferable to have one codepath for all kernel targets.

Another option is to ignore the final line in ui.rs. But that's a total hack.

A third option is to insert a break after handling CommandEnd:

vmtest/src/ui.rs

Lines 207 to 230 in fd83161

Output::CommandEnd(r) => {
if show_cmd {
stage.expand(true);
}
match r {
Ok(retval) => {
rc = *retval as i32;
// Do not increment the error counter here. The VM ran successfully, the error is convyed by
// the command return code.
// Nevertheless, we still want to make it clear to the user by logging to the console.
if *retval != 0 {
error_out_stage(
&mut stage,
&anyhow!("Command failed with exit code: {}", retval),
);
}
}
Err(e) => {
error_out_stage(&mut stage, e);
errors += 1;
}
};
}
. But the command output streamer runs in a separate thread. So we could receive CommandEnd before all the output is streamed to the UI. Better to allow the out-of-order output rather than potentially truncate.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions