Soc*_*tes 2 linux bash terminal typescript
有没有办法直接从 TypeScript 类中执行 Linux 终端命令?这个想法是做类似的事情:
let myTerminal = new LinuxTerminal();
let terminalResult = myTerminal.run("sudo apt-get update");
Run Code Online (Sandbox Code Playgroud)
编辑:
我使用 Angular 通过 Node JS 运行它。
在node.js 中你可以产生一个子进程
const { exec } = require('child_process');
exec('sudo apt-get update', (err, stdout, stderr) => {
// your callback
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5467 次 |
| 最近记录: |