IPWorks IPC 2020 Python Edition

Questions / Feedback?

PipeExec Class

Properties   Methods   Events   Configuration Settings   Errors  

PipeExec provides an easy way to start and interact with a process over Stdin, Stdout, and Stderr.

Syntax

class ipworksipc.PipeExec

Remarks

The PipeExec component provides a way to launch a process and then send/receive data to/from the process. To begin set process_file_name to the path of the process on disk. Optionally set process_args and process_working_dir.

Call start_process to start the process. Next set stdin or call send to send data to the process. Received data will be provided through the on_stdout and on_stderr events.

To terminate the process call stop_process.

Example Code

Pipeexec exec = new Pipeexec();
exec.OnStdout += exec_OnStdout;
exec.ProcessFileName = @"C:\Windows\system32\cmd.exe";
exec.ProcessArgs = "/Q";
exec.StartProcess();

exec.Stdin = "dir" + System.Environment.NewLine;

while (true) //Wait for output
  exec.DoEvents();

static void exec_OnStdout(object sender, PipeexecStdoutEventArgs e)
{
  Console.WriteLine(e.Text);
}

Property List


The following is the full list of the properties of the class with short descriptions. Click on the links for further details.

accept_dataEnables or disables data reception (the Stdout and Stderr events).
bytes_sentThe number of bytes actually sent after an assignment to Stdin.
eolUsed to break the incoming data stream into chunks separated by EOL.
process_argsThe arguments to pass to the process.
process_file_nameThe path to the file on disk to execute.
process_runningWhether the process is running.
process_working_dirThe working directory of the process.
single_line_modeSpecial mode for line-oriented protocols.
stdinA string of data to be sent over the connected pipe.
timeoutA timeout for the class.

Method List


The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

configSets or retrieves a configuration setting.
do_eventsProcesses events from the internal message queue.
get_lineGets a line of text from the server.
interruptInterrupts the current action.
sendSends data over the connected pipe.
send_fileSends the file over the connected pipe.
send_lineSends a string followed by a newline.
start_processStarts the process.
stop_processStops the process.

Event List


The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

on_errorInformation about errors during data delivery.
on_ready_to_sendFired when the class is ready to send data.
on_stderrFired when data come in through stderr.
on_stdoutFired when data come in through stdout.

Configuration Settings


The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.

LogonTypeSpecifies the logon type when starting a process as another user.
PasswordSpecifies the password when starting a process as another user.
ProcessIdReturns the Id of the process which was started.
ProcessStartupFlagsSpecifies the flags used when starting the process in Windows.
ProcessWindowStyleSpecifies the window style when STARTF_USESHOWWINDOW is specified.
UserSpecifies the user when starting a process as another user.
BuildInfoInformation about the product's build.
CodePageThe system code page used for Unicode to Multibyte translations.
LicenseInfoInformation about the current license.
ProcessIdleEventsWhether the class uses its internal event loop to process events when the main thread is idle.
SelectWaitMillisThe length of time in milliseconds the class will wait when DoEvents is called if there are no events to process.
UseInternalSecurityAPITells the class whether or not to use the system security libraries or an internal implementation.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks IPC 2020 Python Edition - Version 20.0 [Build 8162]