Skip to content

CliLocalSession waits for keypress when exiting #209

@marcogmaia

Description

@marcogmaia

I'm running the software on Window10.

The following snippet reproduces the behavior:

int main() {
  std::atexit([]() { std::cout << "Exiting from main."; });

  auto cli = cli::Cli(std::make_unique<cli::Menu>("cli"));
  cli.ExitAction([](auto &out) { out << "Waiting for extra keypress...\n"; });

  auto scheduler = cli::LoopScheduler();
  auto session = cli::CliLocalSession(cli, scheduler, std::cout, 400);
  session.ExitAction([&scheduler](auto &out) {
    scheduler.Stop();
    out << "Stopping scheduler...\n";
  });

  scheduler.Run();

  return 0;
}

produces the following behavior when exiting

cli> exit 
Stopping scheduler...
Waiting for extra keypress...

but the expected is:

cli> exit 
Stopping scheduler...
Waiting for extra keypress...
Exiting from main.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions