KWBackgroundTask.h 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. //
  2. // Licensed under the terms in License.txt
  3. //
  4. // Copyright 2010 Allen Ding. All rights reserved.
  5. //
  6. #import <Foundation/Foundation.h>
  7. // Used to suppress compiler warnings by
  8. // casting receivers to this protocol
  9. @protocol NSTask_KWWarningSuppressor
  10. - (void)setLaunchPath:(NSString *)path;
  11. - (void)setArguments:(NSArray *)arguments;
  12. - (void)setEnvironment:(NSDictionary *)dict;
  13. - (void)setStandardOutput:(id)output;
  14. - (void)setStandardError:(id)output;
  15. - (void)launch;
  16. - (void)waitUntilExit;
  17. @property (readonly) int terminationStatus;
  18. @end
  19. @interface KWBackgroundTask : NSObject
  20. @property (nonatomic, readonly) id<NSTask_KWWarningSuppressor> task;
  21. @property (nonatomic, readonly) NSPipe *standardOutput;
  22. @property (nonatomic, readonly) NSPipe *standardError;
  23. @property (nonatomic, readonly) NSString *command;
  24. @property (nonatomic, readonly) NSArray *arguments;
  25. @property (nonatomic, readonly) NSData *output;
  26. - (instancetype)initWithCommand:(NSString *)command arguments:(NSArray *)arguments;
  27. - (void)launchAndWaitForExit;
  28. @end