From 2dafe81f97e16e87984cb0b4c656cec65d1371ad Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 13 Oct 2024 10:31:32 +0200 Subject: [PATCH] Builtin source to print error if missing both file argument and piped stdin Closes #10774 --- src/builtins/source.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/builtins/source.rs b/src/builtins/source.rs index 5acb73af6..edf8d9bfb 100644 --- a/src/builtins/source.rs +++ b/src/builtins/source.rs @@ -45,6 +45,10 @@ pub fn source(parser: &Parser, streams: &mut IoStreams, args: &mut [&wstr]) -> O // Either a bare `source` which means to implicitly read from stdin or an explicit `-`. if argc == optind && isatty(streams.stdin_fd) { // Don't implicitly read from the terminal. + streams.err.append(wgettext_fmt!( + "%ls: missing filename argument or input redirection\n", + cmd + )); return STATUS_CMD_ERROR; } func_filename = FilenameRef::new(L!("-").to_owned());