As title says I have created a on-demand launch agent that listens to socket and is launched on incoming connection. It works well and after it has done it's job I want to quit it. After quitting system automatically restarts it, OS probably thinks it died accidentally. How can I stop this behaviour? My launch agent is a Cocoa application (without GUI), I have tried quitting with 'exit(EXIT_SUCCESS)' and '[[NSApplication sharedApplication] terminate:self]'
My launchd plist is below:
<?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>Label</key>
<string>com.mycompany.mylaunchagent</string>
<key>ProgramArguments</key>
<array>
<string>/Library/Application Support/com.mycompany.myproduct/myproduct.app/Contents/MacOS/myproduct</string>
</array>
<key>ServiceIPC</key>
<true/>
<key>KeepAlive</key>
<false/>
<key>Sockets</key>
<dict>
<key>MyListenerSocket</key>
<dict>
<key>SockServiceName</key>
<string>12040</string>
</dict>
</dict>