Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Drop --foreground #234

Closed

Conversation

WhyNotHugo
Copy link

Always run in foreground by default. Service manager and supervisors expect services to run in foreground, so they can track the lifetime of the child process. Those that don't implement their own logic to fork daemons anyway.

For users running usbmuxd manually, running in background by default provides a confusing experience, since it gives the impression of exiting immediately.

Anyone needing to run usbmuxd in background can use a shell's & operator or something like nohop.

Always run in foreground by default. Service manager and supervisors
expect services to run in foreground, so they can track the lifetime of
the child process.

For users running `usbmuxd` manually, running in background by default
provides a confusing experience, since it gives the impression of
exiting immediately.

Anyone needing to run `usbmuxd` in background can use a shell's &
operator or something like nohop.
@mexmer
Copy link
Contributor

mexmer commented Nov 21, 2023

your change doesn't make sense.
since i'ts daemon it need to run in background.

while it would make sense that default mode is foreground, instead of background, your code should provide option to start it optionally as background service, because that is intended purpose. therefore your proposed change should also implement optional parameter to run it as background, eg. "switch logic" and instead --foreground implement --background parameter

@WhyNotHugo
Copy link
Author

WhyNotHugo commented Nov 21, 2023 via email

@mexmer
Copy link
Contributor

mexmer commented Nov 21, 2023

you don't always use service manager, but start directly service, for example samba, inetd, syslogd and others are started directly, same for usbmuxd, it can be started by systemd, udev, or you run it as service directly, depends on which system you use.

@WhyNotHugo
Copy link
Author

you don't always use service manager, but start directly service, for example samba, inetd, syslogd and others are started directly, same for usbmuxd, it can be started by systemd, udev, or you run it as service directly, depends on which system you use.

What do you mean by "started directly"? You run them interactively via a terminal? I didn't really account for that sort of use case, I expected that most people would use something like systemd, openrc, init scripts, etc.

I've opened #235 which flips the switch to --background as you suggested above.

@mexmer
Copy link
Contributor

mexmer commented Nov 28, 2023

you don't always use service manager, but start directly service, for example samba, inetd, syslogd and others are started directly, same for usbmuxd, it can be started by systemd, udev, or you run it as service directly, depends on which system you use.

What do you mean by "started directly"? You run them interactively via a terminal? I didn't really account for that sort of use case, I expected that most people would use something like systemd, openrc, init scripts, etc.

I've opened #235 which flips the switch to --background as you suggested above.

not from commandline, but from script in init system. there are distribution that uses sysvinit or some alternative to it, instead of superservice like systemd. those expect started binary to deamonize itself.
that it the way, it worked before superservice and service controllers were added to major linux distributions, and now people either forget or even don't know about it.
i'm not going to argue which is better, but if you create service (daemon), you should support both ways. which is what usbmuxd doing.

@WhyNotHugo
Copy link
Author

Closing in favour of #235

@WhyNotHugo WhyNotHugo closed this Oct 16, 2024
@WhyNotHugo WhyNotHugo deleted the drop-foreground branch October 16, 2024 19:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants