DSUnixTask

DSUnixTask is a library for Mac OS X which allows to launch and interact with awesome looking UNIX tasks.

Showing:

Popularity

Downloads/wk

0

GitHub Stars

41

Maintenance

Last Commit

8yrs ago

Contributors

1

Package

Dependencies

0

License

MIT

Categories

Readme

DSUnixTask

DSUnixTask is a library for Mac OS X which allows to launch and interact with awesome looking UNIX tasks.

Features:

  • Simple interface based on blocks.
  • Process standard output and standard error in real-time.
  • Easily send messages to standard input.
  • Execute tasks either as sub-processes or through an XPC service.
  • Execute throughout the user shell.
  • Logging.

Running a task as a sub-processes

Podfile:
pod 'DSUnixTask/Core'
Usage:
#import <DSUnixTaskSubProcessManager.h>

- (void)runTasfk {
  [[DSUnixTaskSubProcessManager sharedManager] setLoggingEnabled:TRUE];
  DSUnixTask *task = [DSUnixTaskSubProcessManager shellTask];
  [task setCommand:@"/bin/cat"];
  [task setStandardOutputHandler:^(DSUnixTask *task, NSString *output) {
    NSLog(@"%@", output);
  }];
  [task launch];
  [task writeStringToStandardInput:@"Hi!"];
}

XPC

XPC Service:

To create the target for the XPC service:

  1. Use the XPC Service template.
  2. Add a Copy Files build phase to the application.
  • Destination: Wrapper.
  • SubPath: Contents/XPCServices.
  • Copy the XPC service product
  1. Add a dependency to your application’s build phases on the XPC Service.
Podfile:
target 'MyApp' do
  pod 'DSUnixTask/XPCClient'
end

target 'XPCservice' do
  pod 'DSUnixTask/XPCService'
end
Usage:
Client:
#import <DSUnixTaskXPCManager.h>

- (void)runTask {
  [[DSUnixTaskXPCManager sharedManager] setServiceBundleIdentifier:@"com.compary.xpc-bundle-name"];
  [[DSUnixTaskXPCManager sharedManager] setLoggingEnabled:TRUE];
  DSUnixTask *task = [DSUnixTaskSubProcessManager shellTask];
  [task setCommand:@"/bin/cat"];
  [task setStandardOutputHandler:^(DSUnixTask *task, NSString *output) {
    NSLog(@"%@", output);
  }];
  [task launch];
  [task writeStringToStandardInput:@"Hi!"];
}
Service:
#include <Foundation/Foundation.h>
#import "DSUnixTaskServiceMain.h"

int main(int argc, const char *argv[]) {
  runUnixTaskXPCService();
}

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100