LGTM, ack.
Thanks,
Tao Liu
On Wed, Feb 11, 2026 at 3:54 PM neilfsun <loyou85(a)gmail.com> wrote:
When executing external commands (echo, cat, etc.) from input files
with file redirection (>), the output was not properly redirected to
the file but instead printed to stdout.
crash> cat crashrc
echo hi > 1
cat 1
crash> <crashrc
crash> echo hi > 1
hi
crash> cat 1
crash>
When file redirection was used, the code fell through to system() which
outputs to stdout instead of using the global fp that was correctly set
by setup_redirect().
Signed-off-by: neilfsun <neilfsun(a)tencent.com>
Signed-off-by: Feng Sun <loyou85(a)gmail.com>
---
main.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/main.c b/main.c
index 95d455a..2427768 100644
--- a/main.c
+++ b/main.c
@@ -1060,7 +1060,7 @@ is_external_command(void)
strcat(command, args[i]);
}
- if (pc->redirect & REDIRECT_TO_PIPE) {
+ if (pc->redirect & (REDIRECT_TO_PIPE|REDIRECT_TO_FILE)) {
if ((pipe = popen(command, "r")) == NULL) {
error(INFO, "cannot execute: %s\n", command);
return TRUE;
--
2.52.0
--
Crash-utility mailing list -- devel(a)lists.crash-utility.osci.io
To unsubscribe send an email to devel-leave(a)lists.crash-utility.osci.io
https://${domain_name}/admin/lists/devel.lists.crash-utility.osci.io/
Contribution Guidelines:
https://github.com/crash-utility/crash/wiki