JavaScript Backend: Implement h$runInteractiveProcess
Description
The JavaScript backend needs an equivalent to the C function implemented in the process
library's cbits/posix/runProcess.c
file and is foreign imported into the System.Process
module.
This C function has a signature of:
ProcHandle
runInteractiveProcess (char *const args[],
char *workingDirectory, char **environment,
// handles to use for the standard handles. -1 indicates
// create pipe, -2 indicates close.
int fdStdIn, int fdStdOut, int fdStdErr,
// output arguments to return created pipe handle to caller
int *pfdStdInput, int *pfdStdOutput, int *pfdStdError,
gid_t *childGroup, uid_t *childUser,
int flags,
char **failed_doing)
The h$runInteractiveProcess
JavaScript function is given equivalent arguments in the same order, but they will require some processing inside the function to adjust JavaScript-backend RTS types into regular JavaScript strings to be passed to the node.js
spawn
function (https://nodejs.org/api/child_process.html).
See tests affected by this issue and temporarily skipped for the JS backend on https://gitlab.haskell.org/ghc/ghc/-/wikis/javascript-backend/bug_triage
Edited by Sylvain Henry