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

console: io backup restore #525

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

HofiOne
Copy link
Contributor

@HofiOne HofiOne commented Feb 21, 2025

console: add support for restoring the original console io handlers after an attached control client has finished its work

Signed-off-by: Hofi [email protected]

@HofiOne HofiOne changed the title Console io backup restore console: io backup restore Feb 21, 2025
@HofiOne HofiOne marked this pull request as draft February 22, 2025 09:40
@HofiOne HofiOne marked this pull request as ready for review February 22, 2025 11:22
@HofiOne HofiOne force-pushed the console-io-backup-restore branch from f096a01 to f9d4706 Compare February 22, 2025 11:41
@HofiOne HofiOne force-pushed the console-io-backup-restore branch from f9d4706 to ece79b0 Compare February 24, 2025 09:58
@HofiOne HofiOne marked this pull request as draft February 24, 2025 10:49
@HofiOne

This comment was marked as outdated.

@bazsi
Copy link
Member

bazsi commented Feb 24, 2025

@bazsi the _parse_attach_command_args shows that the intended behavior is to handle only one of the attach target options in a given call, either STDIO, LOGS, or the DEBUGGER. But the logic in the control_connection_attach will always steel multiple variations, e.g. if only LOGS is the target it will steel the STDIO as well automatically currently.

I think we only need to handle one case at a time. And stdio I think we can easily remove. That was the first thing I implemented, when I realized I needed to set the log levels as well. So LOGS and DEBUGGER and both should run only as long as the ctl program is running.

We should restore to the original console (as you implemented) when we finish with any of these commands, so the next one can properly run.

What are the intended, valid combinations that we would like to support here?

My bets are

STDIO option -> only STDIO LOGS option -> only LOGS DEBUGGER option -> only DEBUGGER (or STDIO too to get everything in the caller's console?!?)

Could you please confirm?

I hope I addressed these with the response above. Let me know if it didn't or ping me on discord/reddit to chat.

@HofiOne HofiOne force-pushed the console-io-backup-restore branch 2 times, most recently from 2dc8887 to 2ecac27 Compare February 26, 2025 11:28
@HofiOne HofiOne marked this pull request as ready for review February 26, 2025 11:40
@HofiOne HofiOne requested a review from bazsi February 26, 2025 12:09
@HofiOne HofiOne force-pushed the console-io-backup-restore branch from 335ddd6 to 731a71d Compare February 26, 2025 13:05
…p context

This way syslog-ng-ctl -h, syslog-ng-ctl--help and syslog-ng-ctl command -h, syslog-ng-ctl command --help will behave the same way (not like till now)

Signed-off-by: Hofi <[email protected]>
…urate help contexts and help info

Signed-off-by: Hofi <[email protected]>
Signed-off-by: Hofi <[email protected]>

# Conflicts:
#	lib/mainloop-control.c
#	syslog-ng-ctl/commands/attach.c
@HofiOne HofiOne force-pushed the console-io-backup-restore branch from 98f51b9 to 7dba99e Compare February 27, 2025 12:31
@HofiOne HofiOne marked this pull request as draft February 27, 2025 12:52
@HofiOne HofiOne marked this pull request as ready for review February 27, 2025 13:23
…er validation, sub-commands and options do not need to be double validated

Signed-off-by: Hofi <[email protected]>
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.

3 participants