mirror of
https://github.com/vxcontrol/soldr-modules.git
synced 2026-07-21 08:55:22 -04:00
23 lines
387 B
Lua
23 lines
387 B
Lua
local term_core = {}
|
|
|
|
local ffi = require("ffi")
|
|
|
|
if ffi.os == "Windows" then
|
|
ffi.cdef[[
|
|
int _isatty(int fd);
|
|
]]
|
|
else
|
|
ffi.cdef[[
|
|
int isatty(int fd);
|
|
]]
|
|
end
|
|
|
|
function term_core.isatty()
|
|
local isatty = assert(ffi.os == "Windows" and ffi.C._isatty or ffi.C.isatty, "isatty not found")
|
|
-- "1" - STDOUT
|
|
return isatty(1) ~= 0
|
|
end
|
|
|
|
return term_core
|
|
|