
#import <Foundation/Foundation.h>
#import "ABRouter.h"
#import "ABWrapper.h"

#define AB_INITIAL_STDIO_LENGTH_APPROX     2000


@interface ABSubprocessWrapper : NSObject <ABWrapper> {
    @private
    ABRouter *_router;
    
    NSString *_name;
    NSString *_launchPath;
    NSArray *_arguments;
    
    BOOL _verbose;
    
    NSTask *_task;
    NSMutableString *_stdoutText;
    
    NSMutableString *_initialStdout;
    NSMutableString *_initialStderr;
}

- (id)initWithRouter:(ABRouter*)router name:(NSString*)name launchPath:(NSString*)launchPath arguments:(NSArray*)arguments;
- (void)killDashNine;

- (NSString*) _getName;
- (void) _sendEventJson:(NSString*)json;

- (void)respawn;

// private

- (void)checkForEvents;
- (void)stopProcess;
- (void)_spawn;

@property (readonly) NSTask *task;

@end
