Hi,
I am working on a little menu bar app to lauch VMs headless in VirtualBox. For that I am using VBoxManage to generate a list of available VMs. This works flawlessly in a "command line project" but not in an "App project" with the sandbox in place.
I have learned about entitlements (thanks Quinn!) and I am now able to execute VBoxManage with active Sandbox but I am not getting the output of it? Any an idea how to solve this? Below the code I am using that works perfectly without Sandbox:
func list_vms() -> String {
let task = Process()
task.executableURL = URL(fileURLWithPath: "/usr/local/bin/VBoxManage")
let option = "list"
let command = "vms"
task.arguments = [option, command]
let outputPipe = Pipe()
let errorPipe = Pipe()
task.standardOutput = outputPipe
task.standardError = errorPipe
do {
try task.run()
} catch {
print("Error launching VBoxManage")
}
let outputData = outputPipe.fileHandleForReading.readDataToEndOfFile()
let output = String(decoding: outputData, as: UTF8.self)
// let errorData = errorPipe.fileHandleForReading.readDataToEndOfFile()
// let error = String(decoding: errorData, as: UTF8.self)
return output
}
I have also added an entitlement:
com.apple.security.temporary-exception.files.absolute-path.read-only
for /usr/local/bin/As soon as I remove the Sandbox entirely things start to work like in the command line project. I am kind of clueless why the output of VBoxManage is not getting passed on?