diff --git a/Userland/Libraries/LibCore/System.cpp b/Userland/Libraries/LibCore/System.cpp index 423d0b1ca0..e99cf059c8 100644 --- a/Userland/Libraries/LibCore/System.cpp +++ b/Userland/Libraries/LibCore/System.cpp @@ -416,4 +416,12 @@ ErrorOr setegid(gid_t gid) return {}; } +ErrorOr isatty(int fd) +{ + int rc = ::isatty(fd); + if (rc < 0) + return Error::from_syscall("isatty"sv, -errno); + return rc == 1; +} + } diff --git a/Userland/Libraries/LibCore/System.h b/Userland/Libraries/LibCore/System.h index 47f2d6c92f..f942c51c40 100644 --- a/Userland/Libraries/LibCore/System.h +++ b/Userland/Libraries/LibCore/System.h @@ -59,5 +59,6 @@ ErrorOr setuid(uid_t); ErrorOr seteuid(uid_t); ErrorOr setgid(gid_t); ErrorOr setegid(gid_t); +ErrorOr isatty(int fd); }