[Interest] Redirect stdout to a file
Yifei Li
yifli82 at gmail.com
Tue Jul 2 17:23:42 CEST 2013
The child program could be any Lua script written by the user. -Yifei
On Tue, Jul 2, 2013 at 9:59 AM, william.crocker at analog.com <
william.crocker at analog.com> wrote:
> Do you have control over the child program, here?
> Do you have the source code?
> Are you willing to change it?
>
> Bill
>
> On 07/02/2013 09:54 AM, Yifei Li wrote:
> > Hi Scott,
> >
> > I'm working on a Mac. How about you? OS probably matters.
> >
> > Yifei
> >
> >
> > On Mon, Jul 1, 2013 at 11:30 PM, Scott Aron Bloom <
> scott.bloom at onshorecs.com
> > <mailto:scott.bloom at onshorecs.com>> wrote:
> >
> > Yes that is exactly what I do.. ____
> >
> > __ __
> >
> > *From:*Yifei Li [mailto:yifli82 at gmail.com <mailto:yifli82 at gmail.com
> >]
> > *Sent:* Monday, July 1, 2013 7:29 PM
> >
> >
> > *To:* Scott Aron Bloom
> > *Cc:* interest at qt-project.org <mailto:interest at qt-project.org>
> > *Subject:* Re: [Interest] Redirect stdout to a file____
> >
> > __ __
> >
> > Hi Scott,____
> >
> > __ __
> >
> > What I'm trying to do is exactly the same as what you did. ____
> >
> > __ __
> >
> > Can you confirm the following is how you made it? In my experiment,
> the
> > following way makes the newly created process terminate when the GUI
> > crashes. ____
> >
> > __ __
> >
> > QProcess *proc = new QProcess;____
> >
> > connect(proc, SIGNAL(readyReadStandardError()), this
> SLOT(readStderr()));____
> >
> > proc->start();____
> >
> > __ __
> >
> > Thanks,____
> >
> > __ __
> >
> > Yifei____
> >
> > __ __
> >
> > On Mon, Jul 1, 2013 at 6:28 PM, Scott Aron Bloom <
> scott.bloom at onshorecs.com
> > <mailto:scott.bloom at onshorecs.com>> wrote:____
> >
> > Im completely confused on what you are trying to do..____
> >
> > ____
> >
> > I can tell you that, I have a QProcess variable, and I have
> attached to
> > the “stdout/stderr available signals”.. When they trigger, I get
> the
> > stdout and stderr____
> >
> > ____
> >
> > And if the GUI crtashes while the CLI call is running, the CLI
> keeps
> > running.____
> >
> >
> > Scot____
> >
> > ____
> >
> > *From:*Yifei Li [mailto:yifli82 at gmail.com <mailto:
> yifli82 at gmail.com>]
> > *Sent:* Monday, July 01, 2013 3:21 PM____
> >
> >
> > *To:* Scott Aron Bloom
> > *Cc:* interest at qt-project.org <mailto:interest at qt-project.org>
> > *Subject:* Re: [Interest] Redirect stdout to a file____
> >
> > ____
> >
> > So is there a way to achieve what I want? -Yifei____
> >
> > ____
> >
> > On Mon, Jul 1, 2013 at 6:15 PM, Scott Aron Bloom
> > <scott.bloom at onshorecs.com <mailto:scott.bloom at onshorecs.com>>
> wrote:____
> >
> > Yes, calling proc.startDetached still calls the static
> version____
> >
> > ____
> >
> > *From:*Yifei Li [mailto:yifli82 at gmail.com <mailto:
> yifli82 at gmail.com>] ____
> >
> > *Sent:* Monday, July 01, 2013 2:53 PM
> > *To:* Scott Aron Bloom____
> >
> > *Cc:* interest at qt-project.org <mailto:interest at qt-project.org
> >____
> >
> >
> > *Subject:* Re: [Interest] Redirect stdout to a file____
> >
> > ____
> >
> > I just tried, and it does not work. Redirection only works if
> > 'proc->start()'. -Yifei____
> >
> > ____
> >
> > On Mon, Jul 1, 2013 at 5:39 PM, Scott Aron Bloom
> > <scott.bloom at onshorecs.com <mailto:scott.bloom at onshorecs.com>>
> wrote:____
> >
> > Yes… ____
> >
> > ____
> >
> > ____
> >
> > ____
> >
> > *From:*interest-bounces+scott.bloom=onshorecs.com at qt-project.org
> > <mailto:onshorecs.com at qt-project.org>
> > [mailto:interest-bounces+scott.bloom
> > <mailto:interest-bounces%2Bscott.bloom>=
> onshorecs.com at qt-project.org
> > <mailto:onshorecs.com at qt-project.org>] *On Behalf Of *Yifei Li
> > *Sent:* Monday, July 01, 2013 2:25 PM____
> >
> >
> > *To:* interest at qt-project.org <mailto:interest at qt-project.org>
> > *Subject:* Re: [Interest] Redirect stdout to a file____
> >
> > ____
> >
> > Hi Scott,____
> >
> > ____
> >
> > Are you suggesting something as follows? ____
> >
> > QProcess proc;____
> >
> > proc.setStandardOutputFile();____
> >
> > proc.startDetached();____
> >
> > ____
> >
> > Yifei____
> >
> > ____
> >
> > ____
> >
> > ____
> >
> > On Mon, Jul 1, 2013 at 5:08 PM, Scott Aron Bloom
> > <scott.bloom at onshorecs.com <mailto:scott.bloom at onshorecs.com>>
> wrote:____
> >
> > If the goal, is to redirect stdout/stderr, and not have the call
> block
> > (static startDetached).____
> >
> > ____
> >
> > You can still use the NON-static version of the start method____
> >
> > ____
> >
> > Scott____
> >
> > ____
> >
> > *From:*interest-bounces+scott.bloom=onshorecs.com at qt-project.org
> > <mailto:onshorecs.com at qt-project.org>
> > [mailto:interest-bounces+scott.bloom
> > <mailto:interest-bounces%2Bscott.bloom>=
> onshorecs.com at qt-project.org
> > <mailto:onshorecs.com at qt-project.org>] *On Behalf Of *Yifei Li
> > *Sent:* Monday, July 01, 2013 1:58 PM
> > *To:* interest at qt-project.org <mailto:interest at qt-project.org
> >____
> >
> >
> > *Subject:* Re: [Interest] Redirect stdout to a file____
> >
> > ____
> >
> > I guess dup2 needs to be called by the process, correct? But I
> can't
> > change its src code. - Yifei____
> >
> > ____
> >
> > On Mon, Jul 1, 2013 at 4:42 PM, Guido Seifert <wargand at gmx.de
> > <mailto:wargand at gmx.de>> wrote:____
> >
> >
> > If it is only Linux you could use dup2.
> >
> > Windows? No idea.
> >
> > Guido____
> >
> >
> >
> > On Mon, 1 Jul 2013 16:31:19 -0400
> > Yifei Li <yifli82 at gmail.com <mailto:yifli82 at gmail.com>> wrote:
> >
> > > Hi folks,
> > >
> > > I know this can be done using QProcess::setStandardOutputFile.
> > >
> > > However, I need to start my process using the static function
> > > startDetached, and still want to be able to redirect its
> stdout/stderr to
> > > another file.
> > >
> > > Any suggestions?
> > >
> > > Thanks,
> > >
> > > Yifei____
> >
> > _______________________________________________
> > Interest mailing list
> > Interest at qt-project.org <mailto:Interest at qt-project.org>
> > http://lists.qt-project.org/mailman/listinfo/interest____
> >
> > ____
> >
> >
> > _______________________________________________
> > Interest mailing list
> > Interest at qt-project.org <mailto:Interest at qt-project.org>
> > http://lists.qt-project.org/mailman/listinfo/interest____
> >
> > ____
> >
> > ____
> >
> > ____
> >
> >
> > _______________________________________________
> > Interest mailing list
> > Interest at qt-project.org <mailto:Interest at qt-project.org>
> > http://lists.qt-project.org/mailman/listinfo/interest____
> >
> > __ __
> >
> >
> >
> >
> > _______________________________________________
> > Interest mailing list
> > Interest at qt-project.org
> > http://lists.qt-project.org/mailman/listinfo/interest
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20130702/4588e878/attachment.html>
More information about the Interest
mailing list