Pipe:constructor(cmd)constructor
The Pipe constructor executes a process and returns a Pipe value to interact with it.
Parameters
cmd
A string representing the command to execute.
Return value
The constructor returns a new Pipe instance.Example
--! luart-extensions
import console
-- executes "cmd.exe" and create a Pipe
local pipe = sys.Pipe("cmd.exe")
-- skip cmd.exe welcome message
await(pipe:read())
pipe:write("dir\n")
--read the result of the "dir" command excluding the command prompt
result = await(pipe:read()):match(".-\n(.*)\n.-\n")
print(result)