# core/adapters/shell.adapter.ts

> 7 lines of code and 2 definitions.

Tree: Code Parse
Language: typescript
Layer: infrastructure
Canonical: https://banes-lab.com/anatomy/code-parse#file-code-parse-core-adapters-shell-adapter-ts
Source text: https://banes-lab.com/source/code-parse/core/adapters/shell.adapter.ts.txt

Listed in [core/adapters](https://banes-lab.com/api/source/code-parse/core/adapters.md), after [core/adapters/remote.adapter.ts](https://banes-lab.com/source/code-parse/core/adapters/remote.adapter.ts.md) and before [core/adapters/syntax.adapter.ts](https://banes-lab.com/source/code-parse/core/adapters/syntax.adapter.ts.md).

## Definitions

- `runCommand` (lexical_declaration, line 5, exported)
- `invocation` (lexical_declaration, line 6, exported)

## Contained in

- [core/adapters](https://banes-lab.com/anatomy/code-parse/folder-code-parse-core-adapters.md)

## Used by

- [core/adapters/remote.adapter.ts](https://banes-lab.com/source/code-parse/core/adapters/remote.adapter.ts.md)
- [core/coordinators/grammar.coordinator.ts](https://banes-lab.com/source/code-parse/core/coordinators/grammar.coordinator.ts.md)

## Linked from

- [core/adapters](https://banes-lab.com/anatomy/code-parse/folder-code-parse-core-adapters.md)
- [core/coordinators](https://banes-lab.com/anatomy/code-parse/folder-code-parse-core-coordinators.md)

## Source

```typescript
import { execFileSync } from "node:child_process";
import { invocationFor } from "#core/resolvers/shell.resolver";
import process from "node:process";

export const runCommand = function runCommand(name: string, args: readonly string[], cwd: string): void {
    const invocation = invocationFor(process.platform, name, args);
    execFileSync(invocation.file, [...invocation.args], { cwd, stdio: "pipe" });
};
```
