js: simplify the exec call

This commit is contained in:
weishu
2024-02-22 22:41:50 +08:00
parent b904680f13
commit d02855a40a
4 changed files with 26 additions and 44 deletions

View File

@@ -20,8 +20,11 @@ options:
```javascript
import { exec } from 'kernelsu';
const { stdout, stderr } = await exec('ls -l', { cwd: '/tmp'});
console.log(stdout);
const { errno, stdout, stderr } = await exec('ls -l', { cwd: '/tmp' });
if (errno === 0) {
// success
console.log(stdout);
}
```
### fullScreen