How to run terminal interactive programs and capture output

Is there a way to call an interactive command (that asks for user input, like fzf) and capture it’s output? doesn’t seem to allow the process to show anything in stdout and the alternative only gives you back the exit code.

You can use Sys.stdin().readLine() but the stdlib’s sys api is not very comprehensive. However you can always resort to target-native apis. There is a bunch of implementation examples here: tink_cli/src/tink/cli/prompt at master · haxetink/tink_cli · GitHub and of course you can just use the tink_cli lib itself

Thank you very much for your help.
Coincidentally I was reading the source code of those files just yesterday as an alternative to running other commands like gum for simple user interaction.
Something is not clear yet is how that may work for hl and interp targets . I suspect it will not work for interp because it does not support async process interaction.
What does the worker library do by the way?