sys.Pipe(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.

Example

local console = require "console" -- executes "cmd.exe" and create a Pipe local pipe = sys.Pipe("cmd.exe") -- skip cmd.exe welcome message await(pipe:read(100)) 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)