summaryrefslogtreecommitdiff
path: root/xmake/core/base/pipe.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-04-15 00:45:16 +0800
committerruki <[email protected]>2022-04-15 00:45:16 +0800
commit55f541667ccd31e67e61d7eeeeff412552336903 (patch)
tree63397ffb88713b8ee28522305c9cc8386b86246e /xmake/core/base/pipe.lua
parenta61b2aa25af04eb75c6628fbb4f867c9a82ae72a (diff)
improve pipe mode
Diffstat (limited to 'xmake/core/base/pipe.lua')
-rw-r--r--xmake/core/base/pipe.lua13
1 files changed, 11 insertions, 2 deletions
diff --git a/xmake/core/base/pipe.lua b/xmake/core/base/pipe.lua
index affade303..d3a5e3a87 100644
--- a/xmake/core/base/pipe.lua
+++ b/xmake/core/base/pipe.lua
@@ -305,6 +305,8 @@ end
-- pipe:close()
-- end
--
+-- mode: "r", "w", "rB" (block), "wB" (block), "rA" (non-block), "wA" (non-block)
+--
function pipe.open(name, mode, buffsize)
-- open named pipe
@@ -322,10 +324,17 @@ end
-- rpipe:read(...)
-- wpipe:write(...)
--
-function pipe.openpair(buffsize)
+-- mode:
+--
+-- "BB": read block/write block
+-- "BA": read block/write non-block
+-- "AB": read non-block/write block
+-- "AA": read non-block/write non-block (default)
+--
+function pipe.openpair(mode, buffsize)
-- open anonymous pipe pair
- local rpipefile, wpipefile, errors = io.pipe_openpair(buffsize or 0)
+ local rpipefile, wpipefile, errors = io.pipe_openpair(mode, buffsize or 0)
if rpipefile and wpipefile then
return _instance.new(rpipefile), _instance.new(wpipefile)
else