Пытаюсь создать приложение, которое позволяло бы записывать происходящее на экране с помощью vlc.
Нашлась удобная строчка
/Applications/VLC.app/Contents/MacOS/VLC -I dummy screen:// --screen-fps=25 --quiet --sout "#transcode{vcodec=h264,vb072}:standard{access=file,mux=mp4,dst="Desktop/vlc-output-terminal.mp4"}"
которая позволяет моментально начинать запись. Останов записи - ctrl+c.
Все это прекрасно работает в терминале. Теперь хочу упаковать в приложение.
Нашел вот такое:
https://iswift.org/cookbook/execute-a-shell-command
При запуске получаю
Couldn't posix_spawn: error 1
Вот полный текст ошибки
2018-12-31 18:12:28.583388+0300 CenLock[1857:91753] [General] An uncaught exception was raised
2018-12-31 18:12:28.583464+0300 CenLock[1857:91753] [General] Couldn't posix_spawn: error 1
2018-12-31 18:12:28.587944+0300 CenLock[1857:91753] [General] (
0 CoreFoundation 0x00007fff29d8d59b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x00007fff510c0942 objc_exception_throw + 48
2 CoreFoundation 0x00007fff29e1d935 +[NSException raise:format:] + 197
3 Foundation 0x00007fff2c00c5c0 -[NSConcreteTask launchWithDictionary:error:] + 4486
4 CenLock 0x00000001000042b5 $S7CenLock11AppDelegateC14startRecordingyyypSgF + 293
5 CenLock 0x000000010000477c $S7CenLock11AppDelegateC14startRecordingyyypSgFTo + 188
6 AppKit 0x00007fff27a30a43 -[NSApplication(NSResponder) sendAction:to:from:] + 312
7 AppKit 0x00007fff274c5213 -[NSMenuItem _corePerformAction] + 323
8 AppKit 0x00007fff274c4f9b -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] + 114
9 AppKit 0x00007fff2754ac7a -[NSMenu performActionForItemAtIndex:] + 133
10 AppKit 0x00007fff2754abe5 -[NSMenu _internalPerformActionForItemAtIndex:] + 94
11 AppKit 0x00007fff2754aa15 -[NSCarbonMenuImpl _carbonCommandProcessEvent:handlerCallRef:] + 106
12 AppKit 0x00007fff274112a2 NSSLMMenuEventHandler + 882
13 HIToolbox 0x00007fff28fc1904 _ZL23DispatchEventToHandlersP14EventTargetRecP14OpaqueEventRefP14HandlerCallRec + 1541
14 HIToolbox 0x00007fff28fc0c4d _ZL30SendEventToEventTargetInternalP14OpaqueEventRefP20OpaqueEventTargetRefP14HandlerCallRec + 374
15 HIToolbox 0x00007fff28fd5f21 SendEventToEventTarget + 39
16 HIToolbox 0x00007fff2901f3f9 _ZL18SendHICommandEventjPK9HICommandjjhPKvP20OpaqueEventTargetRefS5_PP14OpaqueEventRef + 411
17 HIToolbox 0x00007fff290482ee SendMenuCommandWithContextAndModifiers + 49
18 HIToolbox 0x00007fff290482aa SendMenuItemSelectedEvent + 188
19 HIToolbox 0x00007fff29048184 _ZL19FinishMenuSelectionP13SelectionDataP10MenuResultS2_ + 96
20 HIToolbox 0x00007fff2916087c _ZL19PopUpMenuSelectCoreP8MenuData5PointdS1_tjjPK4RecttjS4_S4_PK14__CFDictionaryPK10__CFStringPP13OpaqueMenuRefPt + 1662
21 HIToolbox 0x00007fff2915fcf7 _ZL26_HandlePopUpMenuSelection8P13OpaqueMenuRefP14OpaqueEventRefj5PointtjjPK4RecttS6_S6_PK14__CFDictionaryPK10__CFStringPS0_Pt + 409
22 HIToolbox 0x00007fff2902840c _HandlePopUpMenuSelectionWithDictionary + 268
23 AppKit 0x00007fff2754179a _NSSLMPopUpCarbonMenu3 + 5632
24 AppKit 0x00007fff275400f4 -[NSCarbonMenuImpl popUpMenu:atLocation:width:forView:withSelectedItem:withFont:withFlags:withOptions:] + 439
25 AppKit 0x00007fff27a1bc6b +[NSStatusBarButtonCell popupStatusBarMenu:inRect:ofView:withEvent:] + 1003
26 AppKit 0x00007fff27a1ad3a -[NSStatusBarButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 159
27 AppKit 0x00007fff274d3670 -[NSControl mouseDown:] + 965
28 AppKit 0x00007fff27bcfd6d -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 5891
29 AppKit 0x00007fff27bcc9c4 -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 2359
30 AppKit 0x00007fff27bcbc70 -[NSWindow(NSEventRouting) sendEvent:] + 497
31 AppKit 0x00007fff27a1e885 -[NSStatusBarWindow sendEvent:] + 348
32 AppKit 0x00007fff27a2d236 -[NSApplication(NSEvent) sendEvent:] + 2462
33 AppKit 0x00007fff2728d8b5 -[NSApplication run] + 812
34 AppKit 0x00007fff2725ca72 NSApplicationMain + 804
35 CenLock 0x000000010000a07d main + 13
36 libdyld.dylib 0x00007fff51cd7015 start + 1
)
Погуглил, но что-то с ходу не нашел ни толкового объяснения для macOS, ни как это дело обойти.
В чем отличие между их примером /usr/bin/env и /Applications/VLC.app/Contents/MacOS/VLC ?