Project

General

Profile

preferred way to launch a process and parse output

Added by Mohammed Rashad over 7 years ago

hello all,

I would like to know what will be the preferred way to start a process and monitor its state, get its output from a wt application.

there are many thirdparty libraries such as boost process, pstream, and or standard unix fork, pipe etc. to do this in desktop and also in wt.

But is there a wt class that can handle this. run/spawn a process without blocking wt application ?


Replies (3)

RE: preferred way to launch a process and parse output - Added by Wim Dumon over 7 years ago

Hi,

As you rightfully point out, many libraries already exist to handle this problem. Wt has no extra built-in support for this, but should work well with existing libraries. In Wt, you'd either be using server push (and run the processing in a separate thread) or call WApplication::processUpdates() at regular intervals.

Wim.

RE: preferred way to launch a process and parse output - Added by Mohammed Rashad over 7 years ago

Thanks Wim,

WServerPush examples run on a new thread. Does it works same for new process ?

RE: preferred way to launch a process and parse output - Added by Wim Dumon over 7 years ago

Mohammed,

In general this is probably not necessary, but in this case it's a practical solution to use a thread to monitor external processes.

Wim.

    (1-3/3)