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.
In node.js you could spawn a child-process
const { exec } = require('child_process');
exec('sudo apt-get update', (err, stdout, stderr) => {
// your callback
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.