Open marcogmaia opened 1 year ago
Hi @marcogmaia ,
first of all, thank you very much for using this library.
I tried your code in the following environment:
In all three cases, I've got the expected output:
c:\Progetti\github\esempi_cli\cli_example\x64\Release>cli_example.exe
cli> exit
Stopping scheduler...
Waiting for extra keypress...
Exiting from main.
c:\Progetti\github\esempi_cli\cli_example\x64\Release>
(no extra keypress needed, by the way: I've just entered "exit" followed by
The complete code is:
#include <cli/loopscheduler.h>
#include "cli/clilocalsession.h"
#include "cli/cli.h"
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;
}
using C++20 standard and the latest version of cli library (i.e., v. 2.1).
Please, let me know what differs from your environment.
@daniele77, thanks man. I'll test with your configs when I get the time. I compiled with clang on windows.
It seems to correctly work with PowerShell
, the issue that I was experiencing was with some integrated terminals, like the VSCode
integrated terminal and Windows terminal
, but if the application is used in a standalone mode it works correctly.
I've tested with msvc2022 and clang17.
https://github.com/daniele77/cli/assets/13483472/ed4b9c5d-5893-4f57-8ce4-58f45b39e352
An example using the code that you've provided.
I'm running the software on Window10.
The following snippet reproduces the behavior:
produces the following behavior when exiting
but the expected is: