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_data | Enables or disables data reception (the Stdout and Stderr events). |
bytes_sent | The number of bytes actually sent after an assignment to Stdin. |
eol | Used to break the incoming data stream into chunks separated by EOL. |
process_args | The arguments to pass to the process. |
process_file_name | The path to the file on disk to execute. |
process_running | Whether the process is running. |
process_working_dir | The working directory of the process. |
single_line_mode | Special mode for line-oriented protocols. |
stdin | A string of data to be sent over the connected pipe. |
timeout | A 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.
config | Sets or retrieves a configuration setting. |
do_events | Processes events from the internal message queue. |
get_line | Gets a line of text from the server. |
interrupt | Interrupts the current action. |
send | Sends data over the connected pipe. |
send_file | Sends the file over the connected pipe. |
send_line | Sends a string followed by a newline. |
start_process | Starts the process. |
stop_process | Stops 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_error | Information about errors during data delivery. |
on_ready_to_send | Fired when the class is ready to send data. |
on_stderr | Fired when data come in through stderr. |
on_stdout | Fired 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.
LogonType | Specifies the logon type when starting a process as another user. |
Password | Specifies the password when starting a process as another user. |
ProcessId | Returns the Id of the process which was started. |
ProcessStartupFlags | Specifies the flags used when starting the process in Windows. |
ProcessWindowStyle | Specifies the window style when STARTF_USESHOWWINDOW is specified. |
User | Specifies the user when starting a process as another user. |
BuildInfo | Information about the product's build. |
CodePage | The system code page used for Unicode to Multibyte translations. |
LicenseInfo | Information about the current license. |
ProcessIdleEvents | Whether the class uses its internal event loop to process events when the main thread is idle. |
SelectWaitMillis | The length of time in milliseconds the class will wait when DoEvents is called if there are no events to process. |
UseInternalSecurityAPI | Tells the class whether or not to use the system security libraries or an internal implementation. |