# execResult

Run a shell command and inspect its outcome.

```js
execResult(command, asRoot = false, timeout = 0)
```

## Arguments

| Argument | Type | Meaning |
| --- | --- | --- |
| `command` | string | Shell command; quote variable data correctly. |
| `asRoot` | boolean | false = mobile, true = root. |
| `timeout` | number | Seconds, 0..86400; 0 means no deadline. Prefer a finite timeout. |

## Returns

{output, stdout, stderr, code, timedOut}; may also include error and outputTruncated.

## Example

```js
const r = execResult("id -u", false, 5);
if (r.error || r.timedOut || r.code !== 0) throw new Error(r.stderr || r.output);
console.log(r.stdout);
```

## Notes

Output is limited to 256 KiB per stream. Cancellation requests cleanup of the command and its background descendants. A command can have side effects even when it times out.

[All JavaScript APIs](https://mcp.applesauceos.com/doc/api.md) · [Automation playbook](https://mcp.applesauceos.com/doc/ai.md)
