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];
}
}
}
+3 -5
View File
@@ -196,11 +196,9 @@ uint64_t main() {
memory_set('\b', PROMPT_LENGTH, (char *)bs);
memory_set(' ', PROMPT_LENGTH, (char *)ws);
while (1) {
char c;
if (read(0, 1, &c)) {
on_char_received(c);
}
char c;
while (read(0, 1, &c)) {
on_char_received(c);
}
return 0;