forked from reliablehosting/GCDTask
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGCDTask.h
More file actions
45 lines (35 loc) · 1.06 KB
/
GCDTask.h
File metadata and controls
45 lines (35 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//
// GCDTask.h
//
// Author: Darvell Long
// Copyright (c) 2014 Reliablehosting.com. All rights reserved.
//
#import <Foundation/Foundation.h>
#ifdef GCDTASK_DEBUG
#define GCDDebug(str, ...) NSLog(str, ##__VA_ARGS__)
#else
#define GCDDebug(str, ...)
#endif
@interface GCDTask : NSObject
{
NSPipe* stdoutPipe;
NSPipe* stderrPipe;
NSPipe* stdinPipe;
NSTask* executingTask;
id stdoutObserver;
id stderrObserver;
}
@property (strong) NSString* launchPath;
@property (strong) NSArray* arguments;
@property BOOL hasExecuted;
@property __block dispatch_source_t stdoutSource;
@property __block dispatch_source_t stderrSource;
- (void) launchWithOutputBlock: (void (^)(NSData* stdOutData)) stdOut
andErrorBlock: (void (^)(NSData* stdErrData)) stdErr
onLaunch: (void (^)()) launched
onExit: (void (^)()) exit;
- (BOOL) WriteStringToStandardInput: (NSString*) input;
- (BOOL) WriteDataToStandardInput: (NSData*) input;
- (void) AddArgument: (NSString*) argument;
- (void) RequestTermination;
@end