On 2023/06/02 18:41, lijiang wrote:
On Wed, May 31, 2023 at 2:07 PM
<crash-utility-request(a)redhat.com> wrote:
> Date: Wed, 31 May 2023 14:01:36 +0800
> From: Hsin-Yi Wang <hsinyi(a)chromium.org>
> To: crash-utility(a)redhat.com, k-hagio-ab(a)nec.com
> Subject: [Crash-utility] [PATCH v2] Output prompt when stdin is not a
> TTY.
> Message-ID: <20230531060349.711886-1-hsinyi(a)chromium.org>
> Content-Type: text/plain; charset="US-ASCII"; x-default=true
>
> When stdin is not a TTY, prompt ("crash> ") won't be displayed. If
> another process interact with crash with piped stdin/stdout, it will not
> get the prompt as a delimiter.
>
> Compared to other debugger like gdb, crash seems intended to give a
> prompt in this case in the beginning of process_command_line(). It
> checks if pc->flags does NOT have any of
> READLINE|SILENT|CMDLINE_IFILE|RCHOME_IFILE|RCLOCAL_IFILE, a
> prompt should be printed. The check will never be true since READLINE is
> set in setup_environment() unconditionally.
>
> It makes more sense to change the READLINE flag in the check to TTY
> instead. Besides this change, the prompt in process_command_line() should
> only be print when it's not in the middle of processing the input file
> recovering from a previous FATAL command, because the prompt will be
> displayed by the exec_input_file().
>
> Additionally, when stdin is not TTY, repeat the command line from user
> after prompt, which can give more context.
>
> The prompt and command line can be opt out by using the silent (-s) flag.
>
>
Thank you for the fix, Hsin-Yi.
For v2, I have no other issues, so: Ack.
Applied. Let's see if no problem.
https://github.com/crash-utility/crash/commit/8527bbff71cbdfd90a67d5cec4a...
Thanks,
Kazu