summaryrefslogtreecommitdiff
path: root/xmake
diff options
context:
space:
mode:
Diffstat (limited to 'xmake')
-rw-r--r--xmake/core/base/os.lua9
-rw-r--r--xmake/core/sandbox/modules/os.lua4
2 files changed, 13 insertions, 0 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index 2d7023ac4..836a8991f 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -45,6 +45,7 @@ os._getenvs = os._getenvs or os.getenvs
os._cpuinfo = os._cpuinfo or os.cpuinfo
os._meminfo = os._meminfo or os.meminfo
os._readlink = os._readlink or os.readlink
+os._signal = os._signal or os.signal
-- syserror code
os.SYSERR_UNKNOWN = -1
@@ -53,6 +54,9 @@ os.SYSERR_NOT_PERM = 1
os.SYSERR_NOT_FILEDIR = 2
os.SYSERR_NOT_ACCESS = 3
+-- signal code
+os.SIGINT = 1
+
-- copy single file or directory
function os._cp(src, dst, rootdir, opt)
opt = opt or {}
@@ -1415,6 +1419,11 @@ function os.readlink(symlink)
return os._readlink(path.absolute(symlink))
end
+-- register signal handler
+function os.signal(signo, handler)
+ os._signal(signo, handler)
+end
+
-- get the program directory
function os.programdir()
return xmake._PROGRAM_DIR
diff --git a/xmake/core/sandbox/modules/os.lua b/xmake/core/sandbox/modules/os.lua
index 9004f66ee..5e2a94e92 100644
--- a/xmake/core/sandbox/modules/os.lua
+++ b/xmake/core/sandbox/modules/os.lua
@@ -82,6 +82,7 @@ sandbox_os.projectdir = os.projectdir
sandbox_os.projectfile = os.projectfile
sandbox_os.getwinsize = os.getwinsize
sandbox_os.getpid = os.getpid
+sandbox_os.signal = os.signal
-- syserror code
sandbox_os.SYSERR_UNKNOWN = os.SYSERR_UNKNOWN
@@ -90,6 +91,9 @@ sandbox_os.SYSERR_NOT_PERM = os.SYSERR_NOT_PERM
sandbox_os.SYSERR_NOT_FILEDIR = os.SYSERR_NOT_FILEDIR
sandbox_os.SYSERR_NOT_ACCESS = os.SYSERR_NOT_ACCESS
+-- signal code
+sandbox_os.SIGINT = os.SIGINT
+
-- copy file or directory
function sandbox_os.cp(srcpath, dstpath, opt)
assert(srcpath and dstpath)