To wait for a child process to finish in Node.js, we listen for the exit event.
For instance, we write
const child = require("child_process").exec("python celulas.py");
child.stdout.pipe(process.stdout);
child.on("exit", () => {
process.exit();
});
to call on with 'exit' to listen for the exit event, which is emitted when the process is finished.