orocos-toolchain / ocl

Orocos Component Library
Other
16 stars 33 forks source link

deployer: do not run a TaskBrowser if the deployer was invoked without a tty input #38

Closed meyerj closed 8 years ago

meyerj commented 8 years ago

For backwards-compatibility there are still small differences between running in daemon mode, rttscript and running a deployer without a tty:

deployer --daemon ...

Main process exits after the deployment. One of the scripts need to block or the whole process terminates.

It should be noted that the deployer is still not a "daemon" process in the usual sense, as it does not detach from the current session (see See http://codingfreak.blogspot.com/2012/03/daemon-izing-process-in-linux.html).

I would consider the daemon mode as broken as long as the deployer does not fork and wait for a signal after all deployment scripts have been run successfully, even if waitForInterrupt() is not explicitly called.

rttscript ...

Actually the same as deployer --daemon, but in this case it might be fine to terminate after all scripts run successfully, so that the tool is useful for other tasks than pure deployment.

deployer ... </dev/null

Without this patch and without a tty as an input the TaskBrowser exits and the deployer shuts down immediately. With this patch we simply call waitForInterrupt() instead, so that the process is running without a TaskBrowser but can still be terminated with SIGINT (reacting on SIGTERM would require an additional patch). This allows to run a normal deployer without additional command line options and without the need to patch the deployment scripts, e.g. from init scripts or non-interactively in CI environments.

meyerj commented 8 years ago

Depends on #39 to shutdown cleanly on SIGTERM while running in headless mode without a tty.