mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-06-17 22:23:03 +00:00
only run termios test if stdin is a tty
This commit is contained in:
+13
-11
@@ -24,18 +24,20 @@ void resetTermios(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
TEST_CASE("init and reset termios") {
|
TEST_CASE("init and reset termios") {
|
||||||
struct termios original;
|
if (isatty(STDIN_FILENO)) {
|
||||||
tcgetattr(0, &original);
|
struct termios original;
|
||||||
SUBCASE("no echo") {
|
tcgetattr(0, &original);
|
||||||
initTermios(false);
|
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) {
|
char getch_(int echo) {
|
||||||
|
|||||||
Reference in New Issue
Block a user