useShell
Run an OS executable with an explicit argument array. Disabled by default (shell.mode: 'none').
const { execute } = useShell()
| Member | Type |
|---|---|
execute | (command: string, args?: string[]) => Promise<ShellResult> |
type ShellResult = {success: booleanstdout: stringstderr: stringerror: string | null}
import { useShell } from 'nextop-app'const { execute } = useShell()const result = await execute('git', ['--version'])if (result.success) console.log(result.stdout)
Security: uses spawn(command, args, { shell: false }) — arguments are never interpreted by a
shell, so shell injection is impossible. Whether a command runs at all depends on shell.mode,
shell.allowedCommands, and shell.requireConsent (see the Security Model). With
requireConsent: true (default), each call shows a native confirmation dialog.