Apr 19, 2020, 21:20 by [email protected]:
> On 4/18/20 6:45 PM, [email protected] wrote:
>
>>
>>
>> The code that allows 'read -p' to be interrupted when posixly_correct, must
>> then be somewhere else, I shall keep lookin', yet I fear I might not find it
>> :-"
>>
>
> Look in read_builtin() and the calls to various zread* functions there.
>
Excelent! Thank you very much for this useful information!
with it I was able to make the necessary local-only changes for myself (patch
attached)
I also did this:
> This is a reasonable idea for posix mode, since the trap action is run
> after the read command returns.
^ in context here:
https://lists.gnu.org/archive/html/bug-bash/2020-04/msg00116.html
Much appreciated, Chet!
Cheers!
diff --git a/builtins/read.def b/builtins/read.def
index 47715512..d07b6cbf 100644
--- a/builtins/read.def
+++ b/builtins/read.def
@@ -112,6 +112,8 @@ $END
extern int errno;
#endif
+#include "execute_cmd.h"
+
struct ttsave
{
int fd;
@@ -606,11 +608,11 @@ read_builtin (list)
CHECK_ALRM;
errno = 0;
if (unbuffered_read == 2)
- retval = posixly_correct ? zreadintr (fd, &c, 1) : zreadn (fd, &c, nchars - nr);
+ retval = zreadintr (fd, &c, 1);
else if (unbuffered_read)
- retval = posixly_correct ? zreadintr (fd, &c, 1) : zread (fd, &c, 1);
+ retval = zreadintr (fd, &c, 1);
else
- retval = posixly_correct ? zreadcintr (fd, &c) : zreadc (fd, &c);
+ retval = zreadcintr (fd, &c);
reading = 0;
if (retval <= 0)
@@ -624,6 +626,7 @@ read_builtin (list)
lastsig = LASTSIG();
if (lastsig == 0)
lastsig = trapped_signal_received;
+ last_command_exit_value = 128|lastsig;
run_pending_traps (); /* because interrupt_immediately is not set */
}
else