base.Channel.openPipe
Opening a pipe channel to a sub-process.
Syntax
openPipe(
command STRING,
mode STRING )
- command is the system command to be executed.
- mode is the open mode. Can be
"r"
,"w"
,"a"
or"u"
(combined with"b"
if needed).
Usage
With the openPipe()
method, you can read from the standard output of a subprocess,
write to the standard input, or both.
Important: This feature is not supported on mobile platforms.
The opening mode can be one of the following:
r
: For read only from standard output of the command.w
: For write only to standard input of the command.a
: For write only to standard input of the command.u
: For read from standard output and write to standard input of the command.
Any of these modes can be followed by
b
, to use binary mode and
avoid CR/LF translation on Windows platforms.
Note: The binary mode is only required in specific cases, and will only take effect when writing
data.
If the opening mode is not one of the above letters, the method will raise error -8085.
Example
CALL ch.openPipe( "ls", "r" )
For a complete example, see Example 2: Executing the ls UNIX command.