Node process spawn a electron and ipc with it.


Is your feature request related to a problem? Please describe.
I am working on a vscode plugin which handle the image in clipboard. vscode don’t provide electron api access, so I try to spawn a electron process as node process, and call clipboard.readImage api in this child electron process, and then pass the image buffer back to vscode plugin process via ipc.

      // vscode plugin 
        let scriptPath = path.join(__dirname, './clipboard.js');
        let electronPath = path.join(__dirname, '../node_modules/.bin/electron');

        var spawn_env = JSON.parse(JSON.stringify(process.env));

        let electron = spawn(electronPath, [scriptPath, scriptPath], {
            env: spawn_env,
            stdio: ['pipe', 'pipe', 'pipe', 'ipc']

        electron.on('message', (data: any) => {
            console.log(data);   // never reach
// clipboard.js  the child process
process.send('I am here')

The vscode plugin process(parent) can not get the message from electron (child)

Would you please give me a help?


OK, I make it myself via node-ipc.