On Tue, 13 Apr 2010, Pritpal Bedi wrote:

Hi,

> > Look at parameters. They give you the answer.
> > To set <cStdOut>, <cStdErr> and <nResult> is necessary to wait inside
> > hb_processRun() until executed command terminates.
> > 
> > If you want to still execute your foreground process then use:
> >    hb_processOpen( <cCommand>, ;
> >                    [ @<hStdIn> ], [ @<hStdOut> ], [ @<hStdErr> ], ;
> >                    [ <lDetach> ], [ @<nPID> ] ) -> <hProcess> | F_ERROR
> > and then:
> >    hb_processValue( <hProcess> [, <lWait=.T.> ] ) -> <nResult>
> > or:
> >    hb_processClose( <hProcess> [, <lGentle=.T.> ] ) -> <lTerminated>
> > 
> > <hStdIn>, <hStdOut> and <hStdErr are file handles from which you can
> > read and write using FREAD()/FWRITE().
> > <nResult> is value returned by executed process (errorLevel()),
> > <lWait> is .T. by default,
> > <lGentle> is .T. by default, when it's .F. the process is killed
> > unconditionally.
> I tried this:
>    hb_processRun( cExecutable, NIL, NIL, NIL, .F. ) 
> Executable is invoked but control is returned to the caller after
> termination of executable.
>    hb_processRun( cExecutable, NIL, NIL, NIL, .T. ) 
> Executable is active without showing up interface ( as a daemon ) 
> but still control is not returned back to caller, hangs forever and has to
> be killed via task manager.

Exactly as I described above.
I know that my English is fatal but"
   "To set <cStdOut>, <cStdErr> and <nResult> is necessary to wait inside
    hb_processRun() until executed command terminates."
seems to be clear.

> I need a functionality where new process executes normally at its own and 
> control is returned back to caller. How this can be achieved with
> hb_processRun() ?

You have to read my message once again.
I gave you all necessary information.
You have to use hb_processOpen(), i.e.:

   hProccess := hb_processOpen( cExecutable )

   if hProccess != F_ERROR
      while ( nResult := hb_processValue( hProccess, .F. ) ) == -1
         ? "waiting for process..."
         hb_idleSleep( 1 )
      enddo
      ? "process terminated with result:", nResult
   endif

best regards,
Przemek
_______________________________________________
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour

Reply via email to