0

I am creating a virtual folder in my system which is needed to be persisted until the user manually removes it. Since it is a virtual folder it is getting removed automatically once the system is turned off or restarted.

So, in order to persist it, i am trying to run it from daemon/launchAgent which runs during the system start. For this i just separated the code which just creates the virtual folder, made it as a separate Xcode application with command line tool template and added its unix executable to LaunchAgents/LaunchDaemons to make it run each time the system reboots.

The creation of virtual folder in my case actually needs the process to be hold on, which is done using the getchar() function. When i build it via Xcode, the process stops at getchar() and the virtual folder gets created properly. Now i took its executable(unix executable file), double tapped on it to run it out of Xcode, even then the process stopped at the required point and worked out properly. Now when i tried it run from the launchdaemon/launchagent, the process does'nt seem to stop anywhere, it just run till the end and finally i could not see my result, i.e., the creation of virtual folder. How could this be resolved?

Thanks in advance and looking forward for any kind of suggestions.

XiOS
  • 1,665
  • 2
  • 18
  • 22
  • 2
    daemons typically don't have a stdin connected and if they do it won't be connected to the user's terminal. You need to use a better synchronization mechanism. – trojanfoe Sep 22 '14 at 07:41
  • May i please know what could be the other synchronization mechanisms for this? I am entirely new to MacOSX development , so please help me here with your suggestions. – XiOS Sep 22 '14 at 07:50
  • So you have a process which is running which is waiting for this virtual folder to be mounted? – trojanfoe Sep 22 '14 at 07:56
  • Yes exactly trojanfoe. – XiOS Sep 22 '14 at 08:56

0 Answers0