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 communication. See the next example.
`$startProcess()`
Tries to run the process. e.g.
%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. e.g.

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[/commnet]
%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();

`$writeToStdin(<command:string>)`
With 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.)
e.g.

     %Process->close_kill();

`$kill()`
Kill the process the hard way (Bad Idea).
`$tryTerminate()`
Tries to terminate the process (It could end 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 invoked by the process when there is new data. The default implementation emits the $readyReadStdout() signal.
`$readyReadStderrEvent()`
This function is invoked 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