Make pipes blocking

This commit is contained in:
2026-06-19 21:49:18 +03:00
parent 415f78fd40
commit 325dc6339a
6 changed files with 53 additions and 45 deletions
+8 -10
View File
@@ -108,16 +108,14 @@ uint64_t main() {
char chunk[64];
uint64_t received;
while (1) {
if ((received = read(0, sizeof(chunk), chunk))) {
for (uint64_t i = 0; i < received; i++) {
if (chunk[i] == '\n') {
line[offset] = '\0';
execute(line);
offset = 0;
} else if (offset < 255) {
line[offset++] = chunk[i];
}
while ((received = read(0, sizeof(chunk), chunk))) {
for (uint64_t i = 0; i < received; i++) {
if (chunk[i] == '\n') {
line[offset] = '\0';
execute(line);
offset = 0;
} else if (offset < 255) {
line[offset++] = chunk[i];
}
}
}