nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 8d7b716ea77a118a1ad4e4c28a2e879fd58a2d6b
parent 034af70a652291c043c428172ce83887205bc835
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Tue, 27 Sep 2022 11:48:42 +0200

startup: quit when standard input is not a TTY (after handling arguments)

Not quitting would make nano hang for several seconds (which is very
annoying) and then die and save an emergency file (which is useless).

This fixes https://savannah.gnu.org/bugs/?63109.

Bug existed chiefly since version 5.9, commit 8d1a666d,
but basically existed since before version 2.0.0.

Diffstat:
Msrc/nano.c | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/nano.c b/src/nano.c @@ -2512,6 +2512,10 @@ int main(int argc, char **argv) /* After handling the files on the command line, allow inserting files. */ UNSET(NOREAD_MODE); + /* Nano is a hands-on editor -- it needs a keyboard. */ + if (!isatty(STDIN_FILENO)) + die(_("Standard input is not a terminal\n")); + /* If no filenames were given, or all of them were invalid things like * directories, then open a blank buffer and allow editing. Otherwise, * switch from the last opened file to the next, that is: the first. */