Commits

Peter Hosey  committed 577cc66

Might as well just splice the test app's code in here.

  • Participants
  • Parent commits 73bba9a

Comments (0)

Files changed (1)

 
 == Example ==
 
-[[https://bitbucket.org/boredzo/prhtask/src/b81965374b1f/PRHTaskTest/PRHTaskTest/main.m|See the test program.]]
+From [[https://bitbucket.org/boredzo/prhtask/src/b81965374b1f/PRHTaskTest/PRHTaskTest/main.m|the test program]]:
+
+{{{
+        PRHTask *task = [[[PRHTask alloc] init] autorelease];
+        task.launchPath = @"/bin/echo";
+        task.arguments = [NSArray arrayWithObject:@"I am the very model of a modern Major-General"];
+        task.accumulatesStandardOutput = YES;
+
+        task.successfulTerminationBlock = ^(PRHTask *completedTask) {
+                NSLog(@"Completed task: %@ with exit status: %i", completedTask, completedTask.terminationStatus);
+                NSLog(@"Accumulated output: %@", [task outputStringFromStandardOutputUTF8]);
+        };
+        task.abnormalTerminationBlock = ^(PRHTask *completedTask) {
+                NSLog(@"Task exited abnormally: %@ with exit status: %i", completedTask, completedTask.terminationStatus);
+        };
+
+        [task launch];
+}}}
 
 == Missing features ==