File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -152,6 +152,7 @@ class OpenPipe_ implements Stream:
152152
153153 read_ -> ByteArray? :
154154 while true :
155+ if not state_ : return null
155156 state_ .wait-for-state READ-EVENT_ | CLOSE-EVENT_
156157 if not state_ : return null
157158 result := read-from-pipe_ resource_
Original file line number Diff line number Diff line change 1+ // Copyright (C) 2025 Toit contributors.
2+ // Use of this source code is governed by a Zero-Clause BSD license that can
3+ // be found in the tests/TESTS_LICENSE file.
4+
5+ import host.pipe
6+
7+ main :
8+ // Just wait for a message.
9+ pipe .stdin .in .read
Original file line number Diff line number Diff line change 1+ // Copyright (C) 2025 Toit contributors.
2+ // Use of this source code is governed by a Zero-Clause BSD license that can
3+ // be found in the tests/TESTS_LICENSE file.
4+
5+ import expect show *
6+
7+ import host.pipe
8+ import system
9+
10+ main args :
11+ toit-exe := args [ 0 ]
12+
13+ my-path := system .program-path
14+ end := my-path .index-of --last "test.toit"
15+ if end == -1 : throw "UNEXPECTED"
16+ input := "$ my-path[.. end ] input.toit"
17+
18+ process := pipe .fork
19+ --create-stdout
20+ --create-stdin
21+ toit-exe
22+ [ toit-exe , input ]
23+
24+ to-process := process .stdin
25+ from-process := process .stdout
26+
27+ from-process .close
28+
29+ expect-null from-process .in .read
30+ to-process .out .write "done"
31+
32+ process .wait
You can’t perform that action at this time.
0 commit comments