Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7564295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:52:10+00:00 2026-05-30T13:52:10+00:00

I set up an NSNotification for NSFileHandleReadCompletionNotification . I set up the standard I/O

  • 0

I set up an NSNotification for NSFileHandleReadCompletionNotification.

I set up the standard I/O with two separate pipes.

NSPipe * input  = NSPipe.new;
NSPipe * output = NSPipe.new;

[serverTask setStandardInput:input];
[serverTask setStandardOutput:output];

I launch a NSTask executing a Java jar, and start reading the data.

[[serverTask.standardOutput fileHandleForReading] readInBackgroundAndNotify];

and I continuously read the data and append the data in an NSTextView if it is new data:

- (void)serverLogHasChanged:(NSNotification *)notification
{
    [[serverTask.standardOutput fileHandleForReading] readInBackgroundAndNotify];

    NSData * newData = [notification.userInfo objectForKey:NSFileHandleNotificationDataItem];

    if (newData != nil && availableData != newData)
    {
        NSMutableString * serverLogString = [NSMutableString stringWithString:serverLog.string];

        [serverLogString appendString:[NSString.alloc initWithData:newData encoding:NSUTF8StringEncoding]];
        [serverLog setString:serverLogString];
        [serverLog.enclosingScrollView.contentView scrollPoint:NSMakePoint(0, NSMaxY(serverLog.enclosingScrollView.contentView.bounds))];
    }

    newData = availableData;
}

However, I’m getting strange output into the NSTextView

enter image description here

Those “>” characters should be lines of actual output, but instead the output ends up in Xcode’s console.

In other words, the console is printing out the output instead of my NSPipe which is printing out only the indication of new lines of the output.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T13:52:11+00:00Added an answer on May 30, 2026 at 1:52 pm

    As has been commented above, it’s a case of adding catching the standard error output. I’ve had a similar issue recently. I solved it by doing the following:

    NSPipe *pipe = [NSPipe pipe];
    [javaTask setStandardOutput:pipe];
    [javaTask setStandardError:pipe];
    NSFileHandle *fileHandleForReading = [pipe fileHandleForReading];
    
    [javaTask launch];
    
    NSData *result = [fileHandleForReading readDataToEndOfFile];
    
    NSString *output = [[NSString alloc] initWithData:result encoding:NSUTF8StringEncoding];
    

    Thanks, CRD for your help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Set<Type> union = new HashSet<Type>(s1); union.addAll(s2); AND Set <Type> union = new HashSet<Type>(); union.addAll(s1);
I set a passphrase when creating a new SSH key on my laptop. But,
My app needs to be set in iOS 5 Notification Center as 'alerts' and
:set ic ignores the case. How do you unset this?
Set content of table ... ViewState[Table1] = Table1; // When remove this line, table
Set rs = conn.Execute(Statement) //rs has 6 fields I want to add the current
set dateformat dmy select isdate('31/1/2012') I thought by going into Change the format of
SET @v1 := SELECT COUNT(*) FROM user_rating; SELECT @v1 When I execute this query
I set up a website to use SqlMembershipProvider as written on this page .
The set up for apache-jmeter allows for a URL to be sent to a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.