I have a console application on a mac that puts out an error code via NSLog. How can I capture the results of NSLog when running the console application in ruby?
I've tried approaches like redirecting stderr, but that doesn't seem to do the trick.
OK, I will edit this to be crystal clear.
I have a program written for MacOS that currently reports its output via NSLog. For all intents and purposes, it can just have this line in its main.m
file:
NSLog(@"Hello world!");
I want to capture the contents of that NSLog. I cannot change the program itself, I just have the log files. I want to do so in Ruby for the purposes of some rspec-based testing.
Right now, I cannot use redirects. Any kind of redirect, as in:
@output = `#{theProgramToTest}`
puts @output
results in no output. If I do the redirection of stderr as described in that previous question I linked to, I still have no result. So how can I capture the results of the program? I do not want to redirect them to a file.