mirror of
https://github.com/janet-lang/janet
synced 2024-11-28 11:09:54 +00:00
Fix isatty code to not use functions only defined if ev is enabled.
This commit is contained in:
parent
5a39a04a79
commit
63bb93fc07
@ -1437,11 +1437,11 @@ JANET_CORE_FN(os_isatty,
|
|||||||
FILE *f = (argc == 1) ? janet_getfile(argv, 0, NULL) : stdout;
|
FILE *f = (argc == 1) ? janet_getfile(argv, 0, NULL) : stdout;
|
||||||
#ifdef JANET_WINDOWS
|
#ifdef JANET_WINDOWS
|
||||||
int fd = _fileno(f);
|
int fd = _fileno(f);
|
||||||
if (fd == -1) janet_panicv(janet_ev_lasterr());
|
if (fd == -1) janet_panic("not a valid stream");
|
||||||
return janet_wrap_boolean(_isatty(fd));
|
return janet_wrap_boolean(_isatty(fd));
|
||||||
#else
|
#else
|
||||||
int fd = fileno(f);
|
int fd = fileno(f);
|
||||||
if (fd == -1) janet_panicv(janet_ev_lasterr());
|
if (fd == -1) janet_panic(strerror(errno));
|
||||||
return janet_wrap_boolean(isatty(fd));
|
return janet_wrap_boolean(isatty(fd));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user