Hello!
I am using Linux mint cinnamon 19.1 and I have some NodeJS project and want packing to a single executable using zeit pkg targeting to platform Linux and Windows. Process packaging is running well, but...
The problem is
When I open that executable with double click the app is running in background process automatically in Linux mint cinnamon 19.1 it didn't show the terminal, the error, also is hard to stop the process I have to do some netstat
and kill processid
I found the same issue and also this issue and have not been answered
My solution
I have a solution that comes to mind with child_process
modules, and spawn('gnome-terminal').exec('node my-node.app')
and of course it didn't work because .exec()
diferrent prototype, and for now I am still can't find how to do spawn terminal and exec the command How to do spawn terminal and exec the command in the terminal that I have spawned
You just only need use .exec()
not .spawn()
const os = require('os');
const child_process = require('child_process');
if (os.platform() === 'linux') {
child_process.exec('gnome-terminal -x bash -c "node your-node.js; exec bash"',
function(err, out, derr) {
console.log(err);
console.log(out);
console.log(derr);
});
}