# process class A class to manage process.
Inherits
object
Description
The Process class is used to start external programs and to communicate with them. !WARNING AT LAST YOU HAVE TO CLOSE THE PROCESS!
Functions
`$addArgument(<process-name:string>)`
With this command you give the process name (or more arguments) for comunication. Es: see the next example.
`$startProcess()`
Tries to run the process. Es: %process=$new(process); %process->$addArg("cmd.exe"); %process->$start();
`<string> $readStdout()`
Reads the data that the process has written to standard output.
`<string> $readStderr()`
Reads the data that the process has written to standard error. Es: -------------------Start: class (test,object) { slotReadStdout() { %stdo = %Process->$readStdout() #%Aoutput->$append(%stdo);// coming soon in the new texteditor class %Aoutput->$settext(%stdo); } slotReadStderr() { %stderr= %Process->$readStderr() #%Aoutput->$append(%stderr);// coming soon in the new texteditor class %Aoutput->$settext(%stderr); } } %tt=$new(test) %A=$new(widget) %A->$setGeometry(100,100,400,300) %layoutA=$new(layout,%A) %Ainput=$new(lineedit,%A) #%Aoutput=$new(textedit,%A)// coming soon in the new texteditor class %Aoutput=$new(label,%A) %bclosekill=$new(button,%A) %bclosekill->$settext("&CloseKill ") %bkill=$new(button,%A) %bkill->$settext("&Kill ") %bterminate=$new(button,%A) %bterminate->$settext("&Ask to Terminate ") %layoutA->$addwidget(%Ainput,0,0) %layoutA->$addwidget(%Aoutput,1,0) %layoutA->$addwidget(%bclosekill,3,0) %layoutA->$addwidget(%bkill,4,0,) %layoutA->$addwidget(%bterminate,5,0) %Process=$new(process) %Process->$addArgument("cmd.exe") %Process->$startProcess(); connect %Process readyReadStdout %tt slotReadStdout connect %Process readyReadStderr %tt slotReadStderr privateimpl(%Ainput,returnPressedEvent) { %command=%Ainput->$text() "\r\n" %Process->$writeToStdin(%command); %Ainput->$setText(""); } privateimpl(%bclosekill,mousepressevent) { %Process->$closekill(); delete %A; } privateimpl(%bkill,mousepressevent) { %Process->$kill(); delete %A; } privateimpl(%bterminate,mousepressevent) { %Process->$tryTerminate(); delete %A; } %A->$show(); --------------------End.
`$writeToStdin(<command:string>)`
Whit this command you send a command to the process:
`$closekill()`
This tries to terminate the process the nice way. If the process is still running after 5 seconds, it terminates the process the hard way. (I think that this is the better way.) Es: %Process->close_kill();
`$kill()`
Kill the process in hard way.(Bad Idea)
`$tryTerminate()`
Tries to terminate the process.(It could be well but...)
`$closeStdin()`
Close the standard Input.
`<boolean> $isRunning()`
Return 1 if the process is running, else return 0.
`<boolean> $normalExit()`
Returns TRUE if the process has exited normally; otherwise returns FALSE.
`$readyReadStdoutEvent()`
This function is invoched by the process when there are new datas. The default implementation emits the $readyReadStdout() signal.
`$readyReadStderrEvent()`
This function is invoched by the process when there are new error messages. The default implementation emits the $readyReadStderr() signal.
Signals
`$readyReadStdout()`
This signal is emitted by the default implementation of $readyReadStdoutEvent(). If you reimplement that function you will have to emit the signal manually (if you still need it).
`$readyReadStderr()`
This signal is emitted by the default implementation of $readyReadStderrEvent().

Index, Object Classes

KVIrc 4.2.0.6190 Documentation
Generated by root at Wed Sep 25 16:57:30 2013