From 456225cb8cbc42673f1168aedf1b7868ecdcd205 Mon Sep 17 00:00:00 2001 From: Sveinbjorn Thordarson Date: Sun, 15 Mar 2020 22:23:10 +0000 Subject: [PATCH] Updated README, updated podspec to require ARC, bumped to version 1.0.9 --- README.md | 26 +++++++++++++------------- STPrivilegedTask.podspec | 10 +++++----- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 2bde9b4..701cb62 100644 --- a/README.md +++ b/README.md @@ -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 CocoaPods. +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 CocoaPods. ## 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 <sveinbjorn@sveinbjorn.org> +Copyright (c) 2008-2020 Sveinbjorn Thordarson <sveinbjorn@sveinbjorn.org> All rights reserved. Redistribution and use in source and binary forms, with or without modification, diff --git a/STPrivilegedTask.podspec b/STPrivilegedTask.podspec index 92393a7..6947d8e 100644 --- a/STPrivilegedTask.podspec +++ b/STPrivilegedTask.podspec @@ -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" => "sveinbjorn@sveinbjorn.org" } 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