mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-09 17:38:00 +00:00
Unix Pageant: make stdout line-buffered in --debug mode.
My normal usage of --debug is to run it in a terminal, where it starts by printing its SSH_AUTH_SOCK setting for me to paste into another terminal to run test commands, and then follows that with diagnostic logging of the requests it's receiving. But if you'd rather get that diagnostic information in some location other than a terminal – say, sent to a file which you're viewing in 'less' so that you can search back and forth in it, or piped to another machine because your test requests are going to come from somewhere out of sight of your monitor – then you might run 'pageant --debug' with its stdout being a pipe or a file rather than a terminal, in which case the standard stdio policy will make it unbuffered, and the diagnostics won't show up in a timely manner. The one-line code change is due to Marco Ricci, who had a rather different motivation.
This commit is contained in:
parent
2c77437149
commit
fca6ce10db
@ -1223,6 +1223,11 @@ void run_agent(FILE *logfp, const char *symlink_path)
|
||||
} else if (life == LIFE_PERM) {
|
||||
pageant_fork_and_print_env(false);
|
||||
} else if (life == LIFE_DEBUG) {
|
||||
/* Force stdout to be line-buffered in preference to unbuffered, so
|
||||
* that if diagnostic output is being piped somewhere, it will arrive
|
||||
* promptly at the other end of the pipe */
|
||||
setvbuf(stdout, NULL, _IOLBF, 0);
|
||||
|
||||
pageant_print_env(getpid());
|
||||
upc->logfp = stdout;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user