From 27a96f0fcb5c6eff141fd8935b4fad5b5e0bf69b Mon Sep 17 00:00:00 2001 From: Oldes Date: Fri, 26 Jul 2024 14:00:33 +0200 Subject: [PATCH] FIX: raw `stdin` input missing the last character when using pipes resolved: https://github.com/Oldes/Rebol-issues/issues/2613 --- src/os/posix/dev-stdio.c | 2 +- src/tests/units/call-test.r3 | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/os/posix/dev-stdio.c b/src/os/posix/dev-stdio.c index 4fc652e746..a18528cefc 100644 --- a/src/os/posix/dev-stdio.c +++ b/src/os/posix/dev-stdio.c @@ -313,7 +313,7 @@ static void Close_StdIO_Local(void) //puts("Read_IO"); if (Std_Inp >= 0) { - + if (!Term_IO) CLR_FLAG(req->modes, RDM_READ_LINE); // Perform a processed read or a raw read? #ifndef HAS_SMART_CONSOLE if (Term_IO && GET_FLAG(req->modes, RDM_READ_LINE)) diff --git a/src/tests/units/call-test.r3 b/src/tests/units/call-test.r3 index 78664f3024..beb22320e6 100644 --- a/src/tests/units/call-test.r3 +++ b/src/tests/units/call-test.r3 @@ -112,8 +112,6 @@ rebol-cmd: func[cmd][ --assert 1 = rebol-cmd {--do "prin 2 1 / 0"} --assert "2" = out-buffer --assert not none? find err-buffer "Math error" - - ===end-group=== @@ -140,4 +138,19 @@ rebol-cmd: func[cmd][ try [delete %units/files/launched.txt] ===end-group=== + +===start-group=== "Raw input" + --test-- "Pipe input" + ;@@ https://github.com/Oldes/Rebol-issues/issues/2613 + --assert all [ + 0 = rebol-cmd rejoin [ + {--do "print 123" | } + to-local-file system/options/boot + { --do "probe read system/ports/input"} + ] + out-buffer == "#{3132330A}^/" + err-buffer == "" + ] +===end-group=== + ~~~end-file~~~ \ No newline at end of file