Closed bbarker closed 3 years ago
Yes, this is currently an issue in how we execute the system function in Inigo. We should hook in stdin and connect properly to the process. We specifically call child_process.spawn with this foreign: https://github.com/hayesgm/inigo/blob/master/Inigo/Async/Base.idr#L15
I actually think the Unix-way to complete this process would be to fork into the new process, but at least for the Node codegen, we're constrained to the NodeJS standard libraries (which have the benefit of generally being cross-platform).
The JavaScript code that currently runs, expanded out is:
(cmd, args, detached, verbose) =>
new Promise((resolve,reject) => {
let opts = {
detached:detached===0n,
stdio: ['ignore', process.stdout, process.stderr]
};
__require_child_process
.spawn(cmd, toArray(args), opts)
.on('close', (code) => resolve(code));
})
The goal is to find a good JavaScript standard lib function or set of functions which let the new process take over the tty input.
Or at least, that is seemingly the case:
So as you can see, when using
inigo exec
, the program does not wait for input, but does when it is run directly from the command line.Here is a repository demonstrating the issue: https://github.com/bbarker/WTInterp