I'm trying to run a binary file width Process.start in dart and redirect its output the stdout and pipe stdin to the process.
Here is my code:
import 'dart:io'; import 'dart:convert'; main() async { Process.start('./test.bin', []).then((p) { p.stdout.listen((bytes) { stdout.add(bytes); stdout.flush(); }); stdin.pipe(p.stdin); }); } The problem is that it only flushes the process's stdout after the process terminates.
After digging around on the internet I found this: "This is caused by libc which by default puts stdout int buffered mode when it is not connected to a terminal."
How could I tell the process that it is running from a terminal?
My goal with this project is to have a terminal in a webapp that interacts with this process running on the backend, so it will be running on a terminal but the process is obviously unaware of that.