summaryrefslogtreecommitdiff
path: root/xmake/core/base
diff options
context:
space:
mode:
authorruki <[email protected]>2020-02-03 22:56:27 +0800
committerruki <[email protected]>2020-02-07 22:45:56 +0800
commit0320b5a0731fca04011d5149a0c7d956033e9140 (patch)
tree312d9193ed57a0216c48f6c5863c87cd0335a6e4 /xmake/core/base
parentcf9970fddd580f8b9bb8ed25d6d9cfa67a607b69 (diff)
fix pipe/socket.wait
Diffstat (limited to 'xmake/core/base')
-rw-r--r--xmake/core/base/pipe.lua6
-rw-r--r--xmake/core/base/process.lua2
-rw-r--r--xmake/core/base/socket.lua16
3 files changed, 13 insertions, 11 deletions
diff --git a/xmake/core/base/pipe.lua b/xmake/core/base/pipe.lua
index 3252ef5e4..16cdf6be5 100644
--- a/xmake/core/base/pipe.lua
+++ b/xmake/core/base/pipe.lua
@@ -96,7 +96,7 @@ function _instance:write(data, opt)
write = write + real
start = start + real
elseif real == 0 then
- local events, waiterrs = self:wait(pipe.EV_WRITE, opt.timeout or -1)
+ local events, waiterrs = _instance.wait(self, pipe.EV_WRITE, opt.timeout or -1)
if events ~= pipe.EV_WRITE then
errors = waiterrs
break
@@ -148,7 +148,7 @@ function _instance:read(size, opt)
table.insert(results, bytes(buff, 1, real))
self:_readbuff_clear()
elseif real == 0 then
- local events, waiterrs = self:wait(pipe.EV_READ, opt.timeout or -1)
+ local events, waiterrs = _instance.wait(self, pipe.EV_READ, opt.timeout or -1)
if events ~= pipe.EV_READ then
data_or_errors = waiterrs
break
@@ -194,7 +194,7 @@ function _instance:connect(opt)
local ok, errors = io.pipe_connect(self:cdata())
if ok == 0 then
opt = opt or {}
- local events, waiterrs = self:wait(pipe.EV_CONN, opt.timeout or -1)
+ local events, waiterrs = _instance.wait(self, pipe.EV_CONN, opt.timeout or -1)
if events == pipe.EV_CONN then
ok, errors = io.pipe_connect(self:cdata())
else
diff --git a/xmake/core/base/process.lua b/xmake/core/base/process.lua
index aa442f6d7..6f5696786 100644
--- a/xmake/core/base/process.lua
+++ b/xmake/core/base/process.lua
@@ -147,6 +147,7 @@ end
function process.open(command, opt)
-- get stdout and pass to subprocess
+ opt = opt or {}
local stdout = opt.stdout
if type(stdout) == "string" then
opt.outpath = stdout
@@ -190,6 +191,7 @@ end
function process.openv(shellname, argv, opt)
-- get stdout and pass to subprocess
+ opt = opt or {}
local stdout = opt.stdout
if type(stdout) == "string" then
opt.outpath = stdout
diff --git a/xmake/core/base/socket.lua b/xmake/core/base/socket.lua
index 079959538..803ee4f5a 100644
--- a/xmake/core/base/socket.lua
+++ b/xmake/core/base/socket.lua
@@ -162,7 +162,7 @@ function _instance:accept(opt)
local sock, errors = io.socket_accept(self:cdata())
if not sock and not errors then
opt = opt or {}
- local events, waiterrs = self:wait(socket.EV_ACPT, opt.timeout or -1)
+ local events, waiterrs = _instance.wait(self, socket.EV_ACPT, opt.timeout or -1)
if events == socket.EV_ACPT then
sock, errors = io.socket_accept(self:cdata())
else
@@ -191,7 +191,7 @@ function _instance:connect(addr, port, opt)
local ok, errors = io.socket_connect(self:cdata(), addr, port, self:family())
if ok == 0 then
opt = opt or {}
- local events, waiterrs = self:wait(socket.EV_CONN, opt.timeout or -1)
+ local events, waiterrs = _instance.wait(self, socket.EV_CONN, opt.timeout or -1)
if events == socket.EV_CONN then
ok, errors = io.socket_connect(self:cdata(), addr, port, self:family())
else
@@ -222,7 +222,7 @@ function _instance:connect_unix(addr, opt)
opt = opt or {}
local ok, errors = io.socket_connect(self:cdata(), addr, opt.is_abstract, self:family())
if ok == 0 then
- local events, waiterrs = self:wait(socket.EV_CONN, opt.timeout or -1)
+ local events, waiterrs = _instance.wait(self, socket.EV_CONN, opt.timeout or -1)
if events == socket.EV_CONN then
ok, errors = io.socket_connect(self:cdata(), addr, opt.is_abstract, self:family())
else
@@ -275,7 +275,7 @@ function _instance:send(data, opt)
start = start + real
wait = false
elseif real == 0 and not wait then
- local events, waiterrs = self:wait(socket.EV_SEND, opt.timeout or -1)
+ local events, waiterrs = _instance.wait(self, socket.EV_SEND, opt.timeout or -1)
if events == socket.EV_SEND then
wait = true
else
@@ -337,7 +337,7 @@ function _instance:sendfile(file, opt)
start = start + real
wait = false
elseif real == 0 and not wait then
- local events, waiterrs = self:wait(socket.EV_SEND, opt.timeout or -1)
+ local events, waiterrs = _instance.wait(self, socket.EV_SEND, opt.timeout or -1)
if events == socket.EV_SEND then
wait = true
else
@@ -393,7 +393,7 @@ function _instance:recv(size, opt)
table.insert(results, bytes(buff, 1, real))
self:_recvbuff_clear()
elseif real == 0 and not wait then
- local events, waiterrs = self:wait(socket.EV_RECV, opt.timeout or -1)
+ local events, waiterrs = _instance.wait(self, socket.EV_RECV, opt.timeout or -1)
if events == socket.EV_RECV then
wait = true
else
@@ -456,7 +456,7 @@ function _instance:sendto(data, addr, port, opt)
while true do
send, errors = io.socket_sendto(self:cdata(), data, addr, port, self:family())
if send == 0 and not wait then
- local events, waiterrs = self:wait(socket.EV_SEND, opt.timeout or -1)
+ local events, waiterrs = _instance.wait(self, socket.EV_SEND, opt.timeout or -1)
if events == socket.EV_SEND then
wait = true
else
@@ -511,7 +511,7 @@ function _instance:recvfrom(size, opt)
self:_recvbuff_clear()
break
elseif recv == 0 and not wait then
- local events, waiterrs = self:wait(socket.EV_RECV, opt.timeout or -1)
+ local events, waiterrs = _instance.wait(self, socket.EV_RECV, opt.timeout or -1)
if events == socket.EV_RECV then
wait = true
else