Closed yaoyhu closed 1 year ago
It is not a tty, in C standard library, if the process is running in a pipe, the stdout will be buffered until you call fflush
or process exits.
So, the printf
in line 7 is buffered with the later printf
in line 11 or line 15 and the actual display happens in returns
.
Since there is a fork
, you will see two pid:xxxx
.
To eliminate this, you should add a fflush(stdout);
after line 7, this will ensure to display all the outputs of previous printfs.
I am writing a simple code about creating process, the output in terminal like below:
➜ tmp gcc p2.c -o p2; ./p2
But with
:AsyncRun gcc p2.c -o p2; ./p2
: