Bug: sonya breaks interactive stdin/stdout behavior #1

Closed
opened 2026-04-21 14:52:54 +00:00 by krnya · 0 comments
krnya commented 2026-04-21 14:52:54 +00:00 (Migrated from github.com)

When a recipe is run through sonya, commands that expect user input do not behave interactively. The prompt is not shown at the right time, and it looks like the program is hanging or not accepting input properly.


Steps to reproduce

sonyafile

CC = clang
FLAGS = -O2 -Wall -Wextra -Werror

default: run

build:
    $(CC) $(FLAGS) main.c -o main

run: build
    ./main

main.c

#include <stdio.h>

int main(void) {
    char buf[256] = {0};
    printf("Enter a string: ");
    scanf("%s", buf);
    printf("You entered: %s\n", buf);
    return 0;
}

Run

sonya

Expected behavior

The program should behave like a normal interactive process:

  • show Enter a string: immediately
  • wait for user input
  • continue after input is entered

Actual behavior

The command output is buffered and only printed after the child process exits. Because of that, the input prompt is not visible when it should be, and interactive programs do not work correctly when launched through sonya.

When a recipe is run through sonya, commands that expect user input do not behave interactively. The prompt is not shown at the right time, and it looks like the program is hanging or not accepting input properly. --- ## Steps to reproduce `sonyafile` ``` CC = clang FLAGS = -O2 -Wall -Wextra -Werror default: run build: $(CC) $(FLAGS) main.c -o main run: build ./main ``` `main.c` ```с #include <stdio.h> int main(void) { char buf[256] = {0}; printf("Enter a string: "); scanf("%s", buf); printf("You entered: %s\n", buf); return 0; } ``` **** Run ``` sonya ``` --- ## Expected behavior The program should behave like a normal interactive process: * show `Enter a string:` immediately * wait for user input * continue after input is entered ## Actual behavior The command output is buffered and only printed after the child process exits. Because of that, the input prompt is not visible when it should be, and interactive programs do not work correctly when launched through sonya.
Sign in to join this conversation.