Pipe:write(data) method

Writes data to the Pipe (into the standard input of the executed process).

Parameters

data

A variable converted to a string value to be written to the Pipe.

Return value

Returns no value.

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)