Skip to content

Commit

Permalink
FIX: raw stdin input missing the last character when using pipes
Browse files Browse the repository at this point in the history
  • Loading branch information
Oldes committed Jul 26, 2024
1 parent 6800d71 commit 27a96f0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/os/posix/dev-stdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
17 changes: 15 additions & 2 deletions src/tests/units/call-test.r3
Original file line number Diff line number Diff line change
Expand Up @@ -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===


Expand All @@ -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~~~

0 comments on commit 27a96f0

Please sign in to comment.