• 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
Re: Being notified of changes to a file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Being notified of changes to a file


  • Subject: Re: Being notified of changes to a file
  • From: "Vitaly Ovchinnikov" <email@hidden>
  • Date: Mon, 21 Jul 2008 19:39:03 +0400

I don't think that you can capture stdout. You need to create a pipe
and redirect your script's output there. And then read from that pipe,
parse and update your progress indicator. A good starting point is
here:
http://www.cocoadev.com/index.pl?NSPipe

On Mon, Jul 21, 2008 at 11:56 AM, Yann Disser <email@hidden> wrote:
> Thanks for your reply.
>
> Hmm, the subject is rather ill chosen. (I started to write the mail and then
> looked a little more into NSPipe before finishing it) My script actually
> writes to stdout.
>
> What I am trying to figure out, is how to respond right away to every single
> line that is written on stdout without waiting for the process to be
> finished.
>
> Perhaps I got something wrong...
>
> Thanks,
> Yann
>
> On 21. Jul 2008, at 0:38, Jens Alfke wrote:
>
>>
>> On 20 Jul '08, at 9:37 AM, Yann Disser wrote:
>>
>>> I am trying to execute a ruby script from within a Cocoa application. I
>>> want to use NSTask (any better ideas?).
>>
>> You can use the Ruby C API to run Ruby inside your process, but that's
>> definitely more work.
>>
>>> My scripts outputs its progress by printing single lines on standard out
>>> containing percentages (e.g. "15%"). How can I update my application
>>> continuously depending on that progress? (for progress bars and other
>>> output)
>>
>> Your subject implies you're writing to a file; don't do that. The Ruby
>> script should write to stdout, and you app should hook up an NSPipe to the
>> NSTask to read its output directly. (This can be a bit tricky, but there's
>> Apple sample code that shows how to do it.)
>>
>> —Jens
>
> _______________________________________________
>
> 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
>
_______________________________________________

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

References: 
 >Being notified of changes to a file (From: Yann Disser <email@hidden>)
 >Re: Being notified of changes to a file (From: Jens Alfke <email@hidden>)
 >Re: Being notified of changes to a file (From: Yann Disser <email@hidden>)

  • Prev by Date: Re: How to get a table column header with an image instead of text?
  • Next by Date: NSURLConnection - bypass Keychain dialog?
  • Previous by thread: Re: Being notified of changes to a file
  • Next by thread: Re: Being notified of changes to a file
  • Index(es):
    • Date
    • Thread