home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2 / Openstep-4.2-Intel-Developer.iso / NextLibrary / Frameworks / Foundation.framework / Versions / B / Headers / NSTask.h < prev    next >
Encoding:
C/C++ Source or Header  |  1997-02-27  |  2.0 KB  |  82 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. #if !defined(STRICT_OPENSTEP) && !defined(STRICT_41) && !defined(STRICT_40)
  52. - (void)interrupt; // Not always possible. Sends SIGINT, or Ctrl-C on Windows
  53. #endif
  54.  
  55. - (void)terminate; // Not always possible. Sends SIGTERM, or Ctrl-Break on Windows
  56.  
  57. // status
  58. - (BOOL)isRunning;
  59.     // true during running; false if could not run or terminated.
  60.  
  61. - (int)terminationStatus;
  62.     // raises if isRunning.
  63.  
  64. @end
  65.  
  66. @interface NSTask (NSTaskConveniences)
  67.  
  68. + (NSTask *)launchedTaskWithLaunchPath:(NSString *)path arguments:(NSArray *)arguments;
  69.     // convenience; create and launch
  70.  
  71. - (void)waitUntilExit;
  72.     // poll the runLoop in defaultMode until task completes
  73.  
  74. @end
  75.  
  76. FOUNDATION_EXPORT NSString *NSTaskDidTerminateNotification;
  77.  
  78. // Obsolete
  79. FOUNDATION_EXPORT NSString *NSTaskDidDieNotification;
  80.  
  81. #endif /* !STRICT_OPENSTEP */
  82.