Re: print application stdout to terminal?
Re: print application stdout to terminal?
- Subject: Re: print application stdout to terminal?
- From: Liam Staskawicz <email@hidden>
- Date: Sun, 13 Jul 2008 12:58:56 -0700
On Jul 12, 2008, at 9:42 PM, Ken Thomases wrote:
On Jul 12, 2008, at 10:25 PM, Liam Staskawicz wrote:
Hi - I realize this is not entirely Xcode specific, but I wasn't
sure where else to post and was thinking there was a reasonable
chance somebody here might have done this before.
Normally, when running my app from within Xcode my stdout makes it
into the Debug window and all is well. However, I have a test
suite that runs as a separate .app that gets launched from a script
as part of a testing process. The only place I can hunt down the
stdout from this app is in Console.app. That's not disastrous,
really, but as I'm opening up the app from Terminal.app with the
'open' command, it would be great to see stdout right there.
A 'man open' does not immediately reveal any flags that might
redirect the output. Any thoughts? Thanks!
/usr/bin/open uses Launch Services to open applications, files, and/
or URLs. Therefore, it's roughly equivalent to double-clicking the
item in the Finder. Launch Services doesn't provide any way to
redirect stdout or stderr, so neither does "open".
However, if you're using a script to launch an application in
certain very constrained circumstances (such as a testing process),
you may directly execute the executable within an application bundle
to launch it, and exercise full control of stdout and stderr. For
example, instead of:
open /path/to/MyApplication.app
you could use:
/path/to/MyApplication.app/Contents/MacOS/MyApplication >/tmp/
myoutput 2>/tmp/myerrors &
If you want the output to simply show up in the Terminal window,
just don't redirect it to a file.
Perfect - this does exactly what I was hoping for.
Cheers,
Liam
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden