summaryrefslogtreecommitdiff
path: root/xmake/plugins/watch/main.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-07-23 17:16:57 +0800
committerruki <[email protected]>2022-07-23 17:16:57 +0800
commit712ee63202583f560e44f604335cf2419ce771c6 (patch)
tree5510ee40181a3a483a34d446fd099b3c9dfd88f3 /xmake/plugins/watch/main.lua
parent75e5e111d3d3504d30f1b17ea51dab5417e44163 (diff)
run arbitrary command
Diffstat (limited to 'xmake/plugins/watch/main.lua')
-rw-r--r--xmake/plugins/watch/main.lua11
1 files changed, 8 insertions, 3 deletions
diff --git a/xmake/plugins/watch/main.lua b/xmake/plugins/watch/main.lua
index 12afa47fd..9d3c8ed0f 100644
--- a/xmake/plugins/watch/main.lua
+++ b/xmake/plugins/watch/main.lua
@@ -58,12 +58,17 @@ function _run_command()
try
{
function ()
- local command = option.get("command")
+ local commands = option.get("commands")
local scriptfile = option.get("script")
- if command then
- for _, command in ipairs(command:split(";")) do
+ local arbitrary = option.get("arbitrary")
+ if commands then
+ for _, command in ipairs(commands:split(";")) do
os.exec(command)
end
+ elseif arbitrary then
+ local program = arbitrary[1]
+ local argv = #arbitrary > 1 and table.slice(arbitrary, 2) or {}
+ os.execv(program, argv)
elseif scriptfile and os.isfile(scriptfile) and path.extension(scriptfile) == ".lua" then
local script = import(path.basename(scriptfile),
{rootdir = path.directory(scriptfile), anonymous = true})