I'm creating an electron application that would launch another application.
When try to, i get the TypeError [ERR_INVALID_ARG_VALUE] The argument 'args' is invalid error.
This is my code in the renderer:
const { ipcMain } = require('electron')
var authType;
var username = "username";
var password = "password";
$(".buttonJSMain").click(function() {
authType = 'authType';
var str = authType + " " + username + " " + password;
ipcRenderer.send('run', authType + " " + username + " " + password);
})
This is my code in the main thread:
ipcMain.on('run', (event, customarg) => {
var child = require('child_process').execFile;
var executablePath = path.join(__dirname, "/loader/application.exe");
child(executablePath, customarg, function(err, data) {
if(err){
console.error(err);
return;
}
console.log(data.toString());
});
})
When I run it, I get this error: TypeError [ERR_INVALID_ARG_VALUE]: The argument 'args' is invalid. Received 'authType username password'