lune
lune copied to clipboard
process.stdin stream for passing into new process.spawn equivalent (process.create?)
Created from a Discord conversation
[1:49 PM] (Erica) DevComp: ill implement a process.stdin which hands you the stdin you were given [1:49 PM] (Erica) DevComp: and you can put that in SpawnOptions [1:50 PM] Shae (Corecii): that would work great, thank you for your work on this! [6:31 AM] (Erica) DevComp: can you create an issue on lune for this [6:31 AM] (Erica) DevComp: i want to get this done in this week and I might forget
This would allow for a simple way to pass the Lune process's stdin into a process created with the process API, allowing user input.
As #211 introduces reader and writer streams into lune, this can be leveraged to have a process.stdin reader stream quite trivially, following it being merged.
Is there a workaround for passing stdin as a stream to an exec'd or created process until this is completed? I want to kick off an interactive program using process.exec() and can't seem to get the terminal's stdin to be inherited by the child process.
@corigne Unfortunately there is none at the moment. But as previously stated, it should be really easy to implement. You can try to take a crack at it yourself if you would like to.
https://github.com/lune-org/lune/blob/39e4c7cc5c7c8cf503961c87b48cbb2e1f65be62/crates/lune-std-process/src/lib.rs#L78-L88
You would need to fetch the current process' stdin, and then add it as a field in the table builder call, similar to how we do it for process.os, process.arch, process.args, etc.