Reputation: 9584
Is there a way to execute a Linux terminal command directly from within a TypeScript class? The idea is to do something similar to:
let myTerminal = new LinuxTerminal();
let terminalResult = myTerminal.run("sudo apt-get update");
EDIT:
I run this through Node JS with Angular.
Upvotes: 8
Views: 16243
Reputation: 4778
In node.js you could spawn a child-process
const { exec } = require('child_process');
exec('sudo apt-get update', (err, stdout, stderr) => {
// your callback
});
Upvotes: 17