description: "A zero-dependency no-shell execFile runner for host-native OS integrations, with utf8 stdio capture, abort propagation, and a hidden console window on Windows."
English | 中文
dsh-native-command runs a host executable directly — never through a shell string — and captures its utf8 stdout and stderr. The caller's abort signal terminates the child, and on Windows the transient console window stays hidden. A failed run rejects with the exit code and both captured streams attached, so callers classify a missing tool, a cancellation, or a real failure without re-running anything. The host-side consumers are the native directory chooser and the open-with-default-application hand-off. It is a library, not a plugin: no ctx, no state, no events.
Use this runner when a host-side integration must execute one native command and needs its output, its failure, or both — and must never involve a shell.
import { runNativeCommand } from '@deepseek-ai/dsh-native-command'
declare const script: string
declare const signal: AbortSignal
const { stdout, stderr } = await runNativeCommand('osascript', ['-e', script], signal)
On exit 0 the call resolves with captured stdout and stderr. On any failure it rejects with the exit code and both captured streams attached, so a caller can tell a missing tool (ENOENT), a cancellation (ABORT_ERR), and a real command failure apart without re-running the command.
The NativeCommandRunner type is the injectable command boundary for host integrations: pass the function (or a wrapper) where the integration needs a testable seam, so tests can substitute a fake runner.
Read these pages when you need the consumers or the general subprocess capability this utility deliberately is not.
None, as the host-side subprocess runner registers nothing model-facing.
Nothing here enters a request prefix; this package neither assembles nor sends a provider request.
These limits define when this runner is not the right tool. They are current package constraints, not a task backlog.
dsh-output-retention bounding before pointing this at commands with meaningful output volume.