Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Something went wrong: -60005 #17

Closed
kapil0408 opened this issue Oct 23, 2017 · 3 comments
Closed

Something went wrong: -60005 #17

kapil0408 opened this issue Oct 23, 2017 · 3 comments

Comments

@kapil0408
Copy link

I am running this code on 10.11.6. but it is showing error.
error:

Something went wrong: -60005
Task <STPrivilegedTask: 0x60000009cc50> is not running
outputString=

Code:
STPrivilegedTask *task = [[STPrivilegedTask alloc] init];
[task setLaunchPath:@"/usr/bin/pluginkit"];
[task setArguments: @[@"-vmA"]];
[task setCurrentDirectoryPath:[[NSBundle mainBundle] resourcePath]];

OSStatus err = [task launch];
if (err != errAuthorizationSuccess) {
    if (err == errAuthorizationCanceled) {
        NSLog(@"User cancelled");
        return;
    }  else {
        NSLog(@"Something went wrong: %d", (int)err);
        // For error codes, see http://www.opensource.apple.com/source/libsecurity_authorization/libsecurity_authorization-36329/lib/Authorization.h
    }
}

[task waitUntilExit];

NSFileHandle *readHandle = [task outputFileHandle];
NSData *outputData = [readHandle readDataToEndOfFile];
NSString *outputString = [[NSString alloc] initWithData:outputData encoding:NSUTF8StringEncoding];
NSLog(@"outputString=%@",outputString);

Please any suggestion or comment on it.

Thanks & Regards

@sveinbjornt
Copy link
Owner

-60005 is errAuthorizationDenied

@kapil0408
Copy link
Author

but when i run this command using NSTask and without Sandbox. it is showing results fine and no error occurs.
but using in Sandbox it is not showing any results.

is there any other approach where i can find using NSTask with Sandbox?

Thanks

@wentingliu
Copy link

There is no way to acquire root privilege when your app is in sandbox.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants