-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated README, updated podspec to require ARC, bumped to version 1.0.9
- Loading branch information
1 parent
3956766
commit 456225c
Showing
2 changed files
with
18 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
# STPrivilegedTask - Objective C class | ||
# STPrivilegedTask - Objective-C class | ||
|
||
An NSTask-like wrapper around [AuthorizationExecuteWithPrivileges()](https://developer.apple.com/library/mac/documentation/Security/Reference/authorization_ref/#//apple_ref/c/func/AuthorizationExecuteWithPrivileges) in the Security API to run shell commands with root privileges in Mac OS X. | ||
An NSTask-like wrapper class around [AuthorizationExecuteWithPrivileges()](https://developer.apple.com/library/mac/documentation/Security/Reference/authorization_ref/#//apple_ref/c/func/AuthorizationExecuteWithPrivileges) in the macOS Security API to run shell commands with root privileges. | ||
|
||
STPrivilegedTask was created a long time ago. It has now been updated to support ARC and is available via <a href="https://cocoapods.org">CocoaPods</a>. | ||
STPrivilegedTask was created a long time ago. It has now been updated over the years to work with the latest versions of macOS and is available via <a href="https://cocoapods.org">CocoaPods</a>. | ||
|
||
## Examples | ||
|
||
|
@@ -45,7 +45,7 @@ OSStatus err = [STPrivilegedTask launchedPrivilegedTaskWithLaunchPath:@"/bin/sh" | |
### Getting task output | ||
|
||
```objective-c | ||
// ... launch task | ||
// ... Launch task | ||
|
||
[privilegedTask waitUntilExit]; | ||
|
||
|
@@ -59,7 +59,7 @@ NSString *outputString = [[NSString alloc] initWithData:outputData encoding:NSUT | |
```objective-c | ||
// ... launch task | ||
// ... Launch task | ||
NSFileHandle *readHandle = [privilegedTask outputFileHandle]; | ||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(getOutputData:) name:NSFileHandleReadCompletionNotification object:readHandle]; | ||
|
@@ -68,19 +68,19 @@ NSFileHandle *readHandle = [privilegedTask outputFileHandle]; | |
// ... | ||
- (void)getOutputData:(NSNotification *)aNotification { | ||
//get data from notification | ||
// Get data from notification | ||
NSData *data = [[aNotification userInfo] objectForKey:NSFileHandleNotificationDataItem]; | ||
//make sure there's actual data | ||
// Make sure there's actual data | ||
if ([data length]) { | ||
// do something with the data | ||
// Do something with the data | ||
NSString *outputString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; | ||
NSLog(outputString); | ||
// go read more data in the background | ||
// Go read more data in the background | ||
[[aNotification object] readInBackgroundAndNotify]; | ||
} else { | ||
// do something else | ||
// Do something else | ||
} | ||
} | ||
``` | ||
|
@@ -93,11 +93,11 @@ You can observe STPrivilegedTaskDidTerminateNotification: | |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(privilegedTaskFinished:) name:STPrivilegedTaskDidTerminateNotification object:nil]; | ||
|
||
- (void)privilegedTaskFinished:(NSNotification *)aNotification { | ||
// do something | ||
// Do something | ||
} | ||
``` | ||
Or alternately, set a termination handler: | ||
Or alternatively, set a termination handler: | ||
```objective-c | ||
privilegedTask.terminationHandler = ^(STPrivilegedTask *privilegedTask) { | ||
|
@@ -164,7 +164,7 @@ It then presents the output of the script in a window, along with the exit code. | |
|
||
## BSD License | ||
|
||
Copyright (c) Sveinbjorn Thordarson <[email protected]> | ||
Copyright (c) 2008-2020 Sveinbjorn Thordarson <[email protected]> | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
Pod::Spec.new do |s| | ||
s.name = "STPrivilegedTask" | ||
s.version = "1.0.7" | ||
s.summary = "An NSTask-like wrapper around Mac OS X Security Framework's AuthorizationExecuteWithPrivileges()" | ||
s.description = "An NSTask-like wrapper around AuthorizationExecuteWithPrivileges() in the Security API to run shell commands with root privileges in Mac OS X." | ||
s.version = "1.0.8" | ||
s.summary = "An NSTask-like wrapper around the macOS Security Framework's AuthorizationExecuteWithPrivileges()" | ||
s.description = "An NSTask-like wrapper around AuthorizationExecuteWithPrivileges() in the Security API to run shell commands with root privileges on macOS." | ||
s.homepage = "http://github.com/sveinbjornt/STPrivilegedTask" | ||
s.license = { :type => 'BSD' } | ||
s.author = { "Sveinbjorn Thordarson" => "[email protected]" } | ||
s.osx.deployment_target = "10.8" | ||
s.source = { :git => "https://github.com/sveinbjornt/STPrivilegedTask.git", :tag => "1.0.7" } | ||
s.source = { :git => "https://github.com/sveinbjornt/STPrivilegedTask.git", :tag => "1.0.8" } | ||
s.source_files = "STPrivilegedTask.{h,m}" | ||
s.exclude_files = "PrivilegedTaskExample" | ||
s.public_header_files = "STPrivilegedTask.h" | ||
s.framework = "Security" | ||
s.requires_arc = false | ||
s.requires_arc = true | ||
end |