summaryrefslogtreecommitdiff
path: root/xmake/core/base/os.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2016-02-27 20:11:22 +0800
committerruki <[email protected]>2016-02-27 20:11:22 +0800
commitdd8ae9c540d5da04a8ffc8a030dfbbd53b26daa9 (patch)
tree6a0a9222796e509fffa5f2c3c53567a29be3921e /xmake/core/base/os.lua
parent4e56f11cf31ad1279505ee5ed7e29945c20f0639 (diff)
add raise interfaces for os
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