summaryrefslogtreecommitdiff
path: root/xmake/core/base/process.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2020-02-05 22:33:46 +0800
committerruki <[email protected]>2020-02-07 22:45:56 +0800
commit69a092643d7725dce1f6fbf7b90ddb3e6f15370e (patch)
treed86f3b08dddc1ec5b0b1dea0f8d035b9f1459dfb /xmake/core/base/process.lua
parent35ffc50b1dc6abc88586ac1986607db16772c686 (diff)
uses runjobs instead of process.asyncrun
Diffstat (limited to 'xmake/core/base/process.lua')
-rw-r--r--xmake/core/base/process.lua69
1 files changed, 0 insertions, 69 deletions
diff --git a/xmake/core/base/process.lua b/xmake/core/base/process.lua
index f1a263260..2abcfa00b 100644
--- a/xmake/core/base/process.lua
+++ b/xmake/core/base/process.lua
@@ -224,74 +224,5 @@ function process.openv(shellname, argv, opt)
end
end
--- async run task and echo waiting info
-function process.asyncrun(task, waitchars)
-
- -- create a coroutine task
- task = coroutine.create(task)
-
- -- we need hide wait characters if is not a tty
- local show_wait = io.isatty()
-
- -- trace
- local waitindex = 0
- local waitchars = waitchars or {'\\', '-', '/', '|'}
- if show_wait then
- utils.printf(waitchars[waitindex + 1])
- end
- io.flush()
-
- -- start and wait this task
- local ok, errors = coroutine.resume(task)
- if not ok then
-
- -- remove wait charactor
- if show_wait then
- utils.printf("\b")
- io.flush()
- end
-
- -- failed
- return false, errors
- end
-
- -- wait and poll task
- while coroutine.status(task) ~= "dead" do
-
- -- trace
- if show_wait then
- waitindex = ((waitindex + 1) % #waitchars)
- utils.printf("\b" .. waitchars[waitindex + 1])
- end
- io.flush()
-
- -- wait some time
- os.sleep(300)
-
- -- continue to poll this task
- local ok, errors = coroutine.resume(task, 0)
- if not ok then
-
- -- remove wait charactor
- if show_wait then
- utils.printf("\b")
- io.flush()
- end
-
- -- failed
- return false, errors
- end
- end
-
- -- remove wait charactor
- if show_wait then
- utils.printf("\b")
- io.flush()
- end
-
- -- ok
- return true
-end
-
-- return module: process
return process