最小限のアプリ バンドルにバイナリをパッケージ化しようとしています。しかし、結果に奇妙な動作が見られます。
私のバンドルには、次の最小限の構造があります。
$ ls -R HelloWorld.app
Contents
HelloWorld.app/Contents:
Info.plist MacOS PkgInfo
HelloWorld.app/Contents/MacOS:
helloworld
helloworld は、以下からコンパイルされた C バイナリです。
#include <stdio.h>
#include <unistd.h>
int main(int argc, char **argv) {
while (1) {
printf("Hello world!\n");
sleep(2);
}
return 0;
}
Info.plist には以下が含まれます。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>helloworld</string>
<key>CFBundleIdentifier</key>
<string>com.litl.helloworld</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>HelloWorld</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0.0</string>
<key>CFBundleVersion</key>
<string>20</string>
<key>LSMinimumSystemVersion</key>
<string>10.6</string>
<key>LSUIElement</key>
<true/>
<key>LSBackgroundOnly</key>
<true/>
</dict>
</plist>
次に、奇妙な動作について説明します。私が走るとき
open ./HelloWorld.app
コマンドは約 30 秒間ハングします。その後、helloworld バイナリが実行されていることを確認できます。ただし、その標準出力は Console.app に表示されません。このバンドルをプログラムで起動すると (NSWorkspace sharedWorkspace] launchApplicationAtURL...)、呼び出しは成功しますが、バイナリはすぐに終了します (コンソールで、エラー コード 2 で終了したことを確認できます)。
これは OS X 10.9.2 上にあります。
私は何を間違っていますか?