I'm trying to open a unix text editor (nano
in this case) by issuing following command in a Node.js script:
if (process.argv[2] === 'edit') {
require('child_process').spawn("sudo", ["nano", dbFile], {
stdio: 'inherit'
});
process.exit(); // try to block here in order not to execute rest of code in this file
}
This opens up nano
, but both the text is weird and it doesn't let me write anything.