C
C
carbanak012022-01-10 00:13:34
JavaScript
carbanak01, 2022-01-10 00:13:34

Why is child_process electron not working?

Hello!
My application sends me a message that I wrote in a text field.
Without assembly, the program works well. But when I collect it via electron-packager no messages are sent.

const { app, BrowserWindow, ipcMain } = require('electron');
const child_process = require('child_process');

ipcMain.on('begin', (e, ...args) => {
  let child = child_process.fork('easyvk.js');
  child.send(args);
});


Can you please suggest a solution to the problem or push to it. I haven't been able to figure it out for a week now.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Belyaev, 2022-01-10
@carbanak01

Most likely a problem with the paths for 'easyvk.js'.
First, it's best to always calculate the absolute path to the file.
Secondly, electron-packager packs the application into asar, and if require is patched to work with it, then child_process most likely does not exist and the file needs to be unpacked before launch.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question