summaryrefslogtreecommitdiff
path: root/xmake/core/base/os.lua
diff options
context:
space:
mode:
Diffstat (limited to 'xmake/core/base/os.lua')
-rw-r--r--xmake/core/base/os.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/xmake/core/base/os.lua b/xmake/core/base/os.lua
index 62b8043a0..78542d72f 100644
--- a/xmake/core/base/os.lua
+++ b/xmake/core/base/os.lua
@@ -233,5 +233,20 @@ function os.cd(dir)
return true
end
+-- raise an exception and abort the current script
+--
+-- the parent function will capture it if we uses pcall or xpcall
+--
+function os.raise(msg, ...)
+
+ -- raise it
+ if msg then
+ error(string.format(msg, ...))
+ else
+ error()
+ end
+end
+
+
-- return module: os
return os