• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Troubles with NSTask, xcodebuild, and NSLog
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Troubles with NSTask, xcodebuild, and NSLog


  • Subject: Troubles with NSTask, xcodebuild, and NSLog
  • From: Dave DeLong <email@hidden>
  • Date: Fri, 19 Jun 2009 16:40:43 -0600

Hi everyone,

I'm writing a little Foundation tool to automate running unit tests. In the tool, I create an NSTask object, have it run xcodebuild on my Tests target, and then I wait until it's done. That works fine.

The problem is that any NSLog() statement after running xcodebuild does nothing. They print out nothing to the Xcode console. They do, however, show up in Console.app.

Here's my code:

NSLog(@"Hello world!");
NSTask * unitTests = [[NSTask alloc] init];
[unitTests setLaunchPath:@"/usr/bin/xcodebuild"];
[unitTests setCurrentDirectoryPath:pathToMyXcodeProject];
[unitTests setArguments:[NSArray arrayWithObjects:@"-target", @"Tests", nil]];
[unitTests launch];
[unitTests waitUntilExit];
[unitTests release];
NSLog(@"This line will never get printed to Xcode's console");


Incidentally, changing the launchPath to something like @"/bin/ls" *will* work as expected.

Why does my second NSLog() not get output on Xcode's console? Is xcodebuild somehow hijacking standardOut? What do I need to do to get my log messages back?

Thanks,

Dave DeLong
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: Basic, but still confuses me (initWithFrame and drawRect)
  • Next by Date: Re: Show the dock icon's context menu:
  • Previous by thread: Re: my drawer won't close
  • Next by thread: Re: Show the dock icon's context menu:
  • Index(es):
    • Date
    • Thread