knurling / ServiceStation

Service Station
39 stars 1 forks source link

doShellScript throws 'A privilege violation occurred.' error #61

Open mark1bean opened 3 years ago

mark1bean commented 3 years ago

I'm getting this error running the following JXA script in Finder. ('whoami' command is just for example.)

`function serviceStationDidSelect(targetedURL, selectedItemURLs, menuKind) {

var app = Application.currentApplication()
app.includeStandardAdditions = true;

try {
    var x = app.doShellScript('whoami');
    app.displayDialog(x);
} catch (e) {
    app.displayDialog(e.message);   
}

}`

Screen Shot 2021-07-03 at 9 53 54 am

I get that there are security concerns, so what is the right way of going about this?