PHP-Daemon
PHP-Daemon copied to clipboard
Command line arguments not retained after automatic restart
I am using command line arguments to control the behavior of the daemon, but they are lost when the daemon restarts. This makes the auto-restart feature unusable for me.
The problem centers around Core_Daemon::command() where the filename of the script is built. Here some default arguments (-d --recoverworkers) are appended, but the original arguments are not mentioned at all.
Sorry you're having trouble! Can you overload the command() method to include your own params?
Unfortunately not, because it's marked private.
If you'd like to change to protected and send a pull request I'm happy to merge it. Being private was strictly about choosing the most conservative option.
On Thu, Aug 21, 2014 at 9:13 AM, Tobias Heintz [email protected] wrote:
Unfortunately not, because it's marked private.
— Reply to this email directly or view it on GitHub https://github.com/shaneharter/PHP-Daemon/issues/53#issuecomment-52943287 .
Great, I'll try it out locally and if that solves the issue (combined with saving the arguments in getopt() it should), I'll send you a pull request.
I've made command() (or rather the 2.0 equivalent getFilename) protected and I'm overriding it in my daemon class. In getopt() I'm saving the entirety of $argv. This solution seems to work nicely. Since I'm working on 2.0, I can't send a pull request to your current master. Maybe you can fix it directly?