Whenever I run the following code, a sound is played perfectly fine but it always prints something to the console. code:
let path = Bundle.main.bundlePath
let task = Process()
task.launchPath = "/usr/bin/env"
task.arguments = ["afplay", path]
let _ = try? task.run()
task.waitUntilExit()
console message:
2023-05-07 01:18:05.779125+0200 afplay[7755:301446] [plugin] AddInstanceForFactory: No factory registered for id <CFUUID 0x60000020c1c0> F8BB1C28-BAE8-11D6-9C31-00039315CD46
2023-05-07 01:18:05.799089+0200 afplay[7755:301446] [aqme] MEMixerChannel.cpp:1636 client <AudioQueueObject@0x10100f200; [0]; play> got error 2003332927 while sending format information
2023-05-07 01:18:06.554636+0200 afplay[7755:301448] [aqme] MEMixerChannel.cpp:1636 client <AudioQueueObject@0x10100f200; [0]; play> got error 2003332927 while sending format information
You are in First Layer spawn
I've tried clearing the terminal by running a different process with launchPath /usr/bin/clear
but it still doesn't work
Setting task.standardOutput
and task.standardError
to nil
before calling task.run()
, I think will cause anything the subprocess outputs to stdout and stderr to be ignored.