[photon] - after fork , execv problem

Sorry, I’m foor at speaking english.

Now, I’m making Serial Communication Program.
In this program, when I click button ," Receive File" , It fork and execute command ,“rz”.

 if ( fork() == 0) 
{
      if ( execv("/bin/rz","rz",NULL) < 0) 
     {
               printf("err");
      }
}

Ths code has no problem in console,
no error: fork, execv

$> gcc main.c
$> ./a.out
 .... rz .... sz filename ... ready.....

but not in photon.

build done ,and it executed,
no error: fork, execv

after I clicked button , it forked and executed.
But forked( child ) proccess was killed at once.

when I put command (any gui program) in parameter of execv function and execute it , the gui program did work

only command ( any console program ) in parameter of execv function. it occured this problem ,
I don’t know why it do that in photon.

Please, Let me know the reason,

Do you run this in a console in photon?
Try calling a shell with the parameter to start rz.

I called a shell with the parameter to start rz.

no problem

after I build my program In momentics and run it , when I click the button , it occurs problem.

Fork and excute is done , but child proccess is killed at once.

um…

try “system” or :
execv("/bin/rz >> /dev/null",“rz”,NULL)

i actually thought of something like:

char* arg_list[] = { “/usr/photon/bin/pterm”, “-z”, “/usr/bin/rz” };
execv( “/usr/photon/bin/pterm”, arg_list );

what actually should call:

pterm -z /usr/bin/rz

This opens an Photon Terminal Window where your output is directed to.
The version by qnxloader directs the output to /dev/null :stuck_out_tongue_winking_eye:

=========================================
“micro” :

i actually thought of something like:

char* arg_list[] = { “/usr/photon/bin/pterm”, “-z”, “/usr/bin/rz” };
execv( “/usr/photon/bin/pterm”, arg_list );

what actually should call:

pterm -z /usr/bin/rz

This opens an Photon Terminal Window where your output is directed to.
The version by qnxloader directs the output to /dev/null :stuck_out_tongue_winking_eye:

Thank you,

I adjust this solution. it is no problem.

but I don’t know how to adjust other solution. I can’t do it.

as if I only do fork it, it work. it do not excute it, “rz”