forked from gnachman/iTerm2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Coprocess.h
48 lines (40 loc) · 1.21 KB
/
Coprocess.h
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
46
47
48
//
// Coprocess.h
// iTerm
//
// Created by George Nachman on 9/24/11.
// Copyright 2011 Georgetech. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface Coprocess : NSObject {
pid_t pid_; // -1 after termination
int outputFd_;
int inputFd_;
NSMutableData *outputBuffer_;
NSMutableData *inputBuffer_;
BOOL eof_;
BOOL mute_;
}
@property (nonatomic, assign) pid_t pid;
@property (nonatomic, assign) int outputFd; // for writing
@property (nonatomic, assign) int inputFd; // for reading
@property (nonatomic, readonly) NSMutableData *outputBuffer;
@property (nonatomic, readonly) NSMutableData *inputBuffer;
@property (nonatomic, assign) BOOL eof;
@property (nonatomic, assign) BOOL mute;
+ (Coprocess *)launchedCoprocessWithCommand:(NSString *)command;
+ (Coprocess *)coprocessWithPid:(pid_t)pid
outputFd:(int)inputFd
inputFd:(int)inputFd;
+ (NSArray *)mostRecentlyUsedCommands;
// Write from outputBuffer
- (int)write;
// Read to end of inputBuffer
- (int)read;
- (BOOL)wantToRead;
- (BOOL)wantToWrite;
- (void)mainProcessDidTerminate;
- (void)terminate;
- (int)readFileDescriptor; // for reading
- (int)writeFileDescriptor; // for writing
@end