summaryrefslogtreecommitdiff
path: root/tests/modules/pipe/pipe_pair.lua
blob: f6b2cb5b17272f44b0f8b7d6d997e630e3d79ee9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import("core.base.pipe")
import("core.base.bytes")

function main()
    local buff = bytes(8192)
    local rpipe, wpipe = pipe.openpair(4096)
    wpipe:write("hello xmake!", {block = true})
    local read, data = rpipe:read(buff, 13)
    if read > 0 and data then
        data:dump()
    end
    rpipe:close()
    wpipe:close()
end