fix stdin bug returning eof in input loop

This commit is contained in:
Andre Puschmann 2018-01-26 10:39:23 +01:00
parent 13b53c4518
commit 44e9a5bd11
1 changed files with 12 additions and 7 deletions

View File

@ -403,14 +403,19 @@ void *input_loop(void *m) {
char key;
while (running) {
cin >> key;
if ('t' == key) {
do_metrics = !do_metrics;
if (do_metrics) {
cout << "Enter t to stop trace." << endl;
} else {
cout << "Enter t to restart trace." << endl;
if (cin.eof() || cin.bad()) {
cout << "Closing stdin thread\n" << endl;
break;
} else {
if ('t' == key) {
do_metrics = !do_metrics;
if (do_metrics) {
cout << "Enter t to stop trace." << endl;
} else {
cout << "Enter t to restart trace." << endl;
}
metrics_screen.toggle_print(do_metrics);
}
metrics_screen.toggle_print(do_metrics);
}
}
return NULL;