platformio / platform-native

Native: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/native
Apache License 2.0
21 stars 28 forks source link

Standard out/ printf not flushed #24

Open squix78 opened 1 year ago

squix78 commented 1 year ago

Problem

On Mac OS X/ Ventura the output of printf will only be displayed after the native application has finished.

How to reproduce

Run the following example by running the upload target:

#include <stdio.h>

int main()
{
    printf("Hello World from PlatformIO!\n");
    for (int i = 0; i < 255; i++) {
        printf("I: %d", i);
    }
    while (1) {
        // endless loop
    }
    return 0;
}

Expected: while the program runs there is output on the console Actual: there is no output of the printf statements

When I run the compiled program directly I get the desired output, so in conclusion the pio run -t exec target must swallow the console output

proddy commented 4 months ago

did you find a solution to this? I'm also trying to find a way to change the console/tty behavior of -t exec like you can do with the monitor settings.