home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / DEV.Z / NSTask.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-09-11  |  1.8 KB  |  79 lines

  1. /*    NSTask.h
  2.     Process creation
  3.     Copyright 1996, NeXT Software, Inc.  All rights reserved.
  4. */
  5.  
  6. #if !defined(STRICT_OPENSTEP)
  7.  
  8. #import <Foundation/NSObject.h>
  9.  
  10. @class NSString, NSArray, NSDictionary;
  11.  
  12. @interface NSTask : NSObject
  13.  
  14. // Create an NSTask which can be run at a later time
  15. // An NSTask can only be run once. Subsequent attempts to
  16. // run an NSTask will raise.
  17. // Upon task death a notification will be sent
  18. //   { Name = NSTaskDidTerminateNotification; object = task; }
  19. //
  20.  
  21. - (id)init;
  22.  
  23. // set parameters
  24. // these methods can only be done before a launch
  25. - (void)setLaunchPath:(NSString *)path;
  26. - (void)setArguments:(NSArray *)arguments;
  27. - (void)setEnvironment:(NSDictionary *)dict;
  28.     // if not set, use current
  29. - (void)setCurrentDirectoryPath:(NSString *)path;
  30.     // if not set, use current
  31.  
  32. // set standard I/O channels; may be either an NSFileHandle or an NSPipe
  33. - (void)setStandardInput:(id)input;
  34. - (void)setStandardOutput:(id)output;
  35. - (void)setStandardError:(id)error;
  36.  
  37. // get parameters
  38. - (NSString *)launchPath;
  39. - (NSArray *)arguments;
  40. - (NSDictionary *)environment;
  41. - (NSString *)currentDirectoryPath;
  42.  
  43. // get standard I/O channels; could be either an NSFileHandle or an NSPipe
  44. - (id)standardInput;
  45. - (id)standardOutput;
  46. - (id)standardError;
  47.  
  48. // actions
  49. - (void)launch;
  50.  
  51. - (void)terminate;
  52.     // Not always possible.
  53.  
  54. // status
  55. - (BOOL)isRunning;
  56.     // true during running; false if could not run or terminated.
  57.  
  58. - (int)terminationStatus;
  59.     // raises if isRunning.
  60.  
  61. @end
  62.  
  63. @interface NSTask (NSTaskConveniences)
  64.  
  65. + (NSTask *)launchedTaskWithLaunchPath:(NSString *)path arguments:(NSArray *)arguments;
  66.     // convenience; create and launch
  67.  
  68. - (void)waitUntilExit;
  69.     // poll the runLoop in defaultMode until task completes
  70.  
  71. @end
  72.  
  73. FOUNDATION_EXPORT NSString *NSTaskDidTerminateNotification;
  74.  
  75. // Obsolete
  76. FOUNDATION_EXPORT NSString *NSTaskDidDieNotification;
  77.  
  78. #endif /* !STRICT_OPENSTEP */
  79.