mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-02-16 10:41:01 +00:00
only run termios test if stdin is a tty
This commit is contained in:
@@ -24,18 +24,20 @@ void resetTermios(void) {
|
||||
}
|
||||
|
||||
TEST_CASE("init and reset termios") {
|
||||
struct termios original;
|
||||
tcgetattr(0, &original);
|
||||
SUBCASE("no echo") {
|
||||
initTermios(false);
|
||||
if (isatty(STDIN_FILENO)) {
|
||||
struct termios original;
|
||||
tcgetattr(0, &original);
|
||||
SUBCASE("no echo") {
|
||||
initTermios(false);
|
||||
}
|
||||
SUBCASE("yes echo") {
|
||||
initTermios(true);
|
||||
}
|
||||
resetTermios();
|
||||
struct termios current;
|
||||
tcgetattr(0, ¤t);
|
||||
CHECK(std::memcmp(&original, ¤t, sizeof(struct termios)) == 0);
|
||||
}
|
||||
SUBCASE("yes echo") {
|
||||
initTermios(true);
|
||||
}
|
||||
resetTermios();
|
||||
struct termios current;
|
||||
tcgetattr(0, ¤t);
|
||||
CHECK(std::memcmp(&original, ¤t, sizeof(struct termios)) == 0);
|
||||
}
|
||||
|
||||
char getch_(int echo) {
|
||||
|
||||
Reference in New Issue
Block a user