only run termios test if stdin is a tty

This commit is contained in:
Lion Kortlepel
2022-05-26 16:14:05 +02:00
parent 70e53c2a70
commit 46b92b4992
+2
View File
@@ -24,6 +24,7 @@ void resetTermios(void) {
} }
TEST_CASE("init and reset termios") { TEST_CASE("init and reset termios") {
if (isatty(STDIN_FILENO)) {
struct termios original; struct termios original;
tcgetattr(0, &original); tcgetattr(0, &original);
SUBCASE("no echo") { SUBCASE("no echo") {
@@ -36,6 +37,7 @@ TEST_CASE("init and reset termios") {
struct termios current; struct termios current;
tcgetattr(0, &current); tcgetattr(0, &current);
CHECK(std::memcmp(&original, &current, sizeof(struct termios)) == 0); CHECK(std::memcmp(&original, &current, sizeof(struct termios)) == 0);
}
} }
char getch_(int echo) { char getch_(int echo) {