Fix "Failed tcsetattr(TCSADRAIN)" when nix repl is not a TTY

Before:
```
$ echo builtins.nixVersion | nix repl
Welcome to Nix 2.18.1. Type :? for help.

Failed tcsetattr(TCSADRAIN): Inappropriate ioctl for device
"2.18.1"

Failed tcsetattr(TCSADRAIN): Inappropriate ioctl for device
```

After:
```
$ echo builtins.nixVersion | nix repl
Nix 2.21.0pre20240131_dirty
Type :? for help.
"2.21.0pre20240131_dirty"
```
This commit is contained in:
Rebecca Turner 2024-02-13 11:09:12 -08:00
parent 5b26c66a8c
commit a694cfb7bd
No known key found for this signature in database

View File

@ -351,7 +351,6 @@ bool NixRepl::getLine(std::string & input, const std::string & prompt)
}; };
setupSignals(); setupSignals();
Finally resetTerminal([&]() { rl_deprep_terminal(); });
char * s = readline(prompt.c_str()); char * s = readline(prompt.c_str());
Finally doFree([&]() { free(s); }); Finally doFree([&]() { free(s); });
restoreSignals(); restoreSignals();