Skip to content

Instantly share code, notes, and snippets.

View mashhoodr's full-sized avatar
🏎️
being awesome!

Mashhood Rastgar mashhoodr

🏎️
being awesome!
View GitHub Profile
@mashhoodr
mashhoodr / NSTask+Tee
Last active May 21, 2018 06:58
NSTask code which outputs directly to a file as well.
NSTask *task;
task = [[NSTask alloc] init];
[task setLaunchPath: @"/bin/bash"];
[task setArguments: @[ @"-c", @"echo Hello | tee -a ~/Desktop/output.txt" ]];
[task setCurrentDirectoryPath:@"~/Development/"];
NSPipe *pipe;
pipe = [NSPipe pipe];
[task setStandardOutput: pipe];
[task setStandardError: pipe];