Node.js/exec:修订间差异
来自康健生活
| 第23行: | 第23行: | ||
使用方法。 | 使用方法。 | ||
{{Hc|main.js|<syntaxhighlight lang="javascript"> | {{Hc|main.js|<syntaxhighlight lang="javascript"> | ||
const exec = require('. | const exec = require('./exec.js'); | ||
... | ... | ||
const result = await exec(cmd).catch(err => console.log(err)); | const result = await exec(cmd).catch(err => console.log(err)); | ||
</syntaxhighlight>}} | </syntaxhighlight>}} | ||