wxProcess termination??

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
JumpAround
In need of some credit
In need of some credit
Posts: 5
Joined: Fri Feb 04, 2005 8:15 am

wxProcess termination??

Post by JumpAround » Fri Aug 26, 2005 11:21 am

HI all

I have a problem. I thought I got a bug somewhere in my code because executing a process never calls eaither OnTerminate function or an process event like it is described in the manual. I was debuging exec.cpp example and it does not work either. It fires a process I want to execute ( synchronious or asynchronious it does not matter ) and then blocks for some reason. OnTerminate function is never called.

I was trying to use wxShell command and i have the same result. This function opens a terminal launches a process ( ie. 'ls' ) and blocks never returnig any value. I am using mandrake 9.2 with wxWidgets ver 2.6.1

Is there any known bug??

Please help

asteelef
Earned a small fee
Earned a small fee
Posts: 20
Joined: Tue Jun 28, 2005 6:38 pm

Post by asteelef » Fri Aug 26, 2005 9:36 pm

This works for me on windows XP-
Starting the process:

Code: Select all

   wxProcess *process = new wxProcess( this, SOME_PROCESS );
   process->Redirect();
   currentProcId = ::wxExecute( someExecFile, wxEXEC_ASYNC, process );
My on terminate function:

Code: Select all

void MyDialog::OnSomeProcessTerm(wxProcessEvent& WXUNUSED(event))
In my event table:

Code: Select all

    EVT_END_PROCESS(SOME_ID, MyDialog::OnSomeProcessTerm)
Are you doing something similar?

JumpAround
In need of some credit
In need of some credit
Posts: 5
Joined: Fri Feb 04, 2005 8:15 am

Post by JumpAround » Mon Aug 29, 2005 10:13 am

Yes I am doing exactly the the same what you have posted.

#define ID 1000

BEGIN_EVENT_TABLE(MyFrame, wxFrame)
...
EVT_END_PROCESS(ID, MyFrame::OnProcessTerminate)
...
END_EVENT_TABLE()

...
void MyFrame::OnProcessTerminate(wxProcessEvent& event)
{
printf("My process exited\n");
}


This is how I start the process:

void MyFrame::OnStartProcess(wxCommandEvent& event)
{

wxProcess *process = new wxProcess( this, ID );
process->Redirect();
int currentProcId = ::wxExecute( "ls", wxEXEC_ASYNC, process );

}


'ls' process is executed but never calls OnProcessTerminate function.

What is wrong, any suggestions???

Post Reply