# async-execute

> 🦅 Execute command in a child process

Latest version **2.0.1** (published 2025-10-19) · UNLICENSED license · 0 weekly downloads

## Install

```sh
npm install async-execute
pnpm add async-execute
yarn add async-execute
bun add async-execute
```

## Health

**Score 60/100 (C)** — status: stable.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2025-10-19 |
| First published | 2018-06-06 |
| Weekly downloads | 0 |
| License | UNLICENSED |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | omrilotan |
| Maintainers | omrilotan |
| Keywords | async, execute, exec, child_process, shell, promise, spawn, command, cmd |

## Links

- npm: https://www.npmjs.com/package/async-execute
- Repository: https://github.com/omrilotan/async-execute
- Homepage: https://omrilotan.com/async-execute/
- Issues: https://github.com/omrilotan/async-execute/issues
- npm.io page: https://npm.io/package/async-execute

## Alternatives

- [@commercetools/sync-actions](https://npm.io/package/@commercetools/sync-actions.md) — 25.1K weekly downloads
- [cwait](https://npm.io/package/cwait.md) — 21.4K weekly downloads
- [@ledgerhq/hw-app-cosmos](https://npm.io/package/@ledgerhq/hw-app-cosmos.md) — 4.2K weekly downloads
- [@financial-times/o-loading](https://npm.io/package/@financial-times/o-loading.md) — 2.8K weekly downloads
- [fa](https://npm.io/package/fa.md) — 185 weekly downloads

## Recent versions

- 2.0.1 (latest) — 2025-10-19
- 2.0.0 — 2024-08-21
- 1.2.0 — 2020-04-02
- 1.1.0 — 2019-03-27
- 1.0.1 — 2018-11-05
- 1.0.0 — 2018-06-06

## README

# async-execute [![](https://img.shields.io/npm/v/async-execute.svg)](https://www.npmjs.com/package/async-execute)

## 🦅 Execute command in a child process

```js
import { execute } from "async-execute";

const commit_message = await execute("git log -1 --pretty=%B"); // Committed some changes
```

## Options

### Pipe stdout and stderr (default: false)

```js
await execute("npm t", { pipe: true });
```

### Exit process with child's exit code (default: false)

```js
await execute("npm t", { pipe: true, exit: true });
```

### Check a script exits properly

```js
let code = 0;

try {
	const result = await execute("exit 2");
	code = result.code;
} catch (error) {
	code = error.code;
}

if (code > 0) {
	// something must have gone wrong
}
```

## Any [exec option](https://nodejs.org/api/child_process.html#child_processexeccommand-options-callback) can be passed

```js
await execute("echo $API_KEY", {
	env: { API_KEY: "vQQNJe7lnz4rTbYvr61VywR0wRlRzCyI" },
});

await execute("pwd", { cwd: "~/app" });
```

---
_Source: https://npm.io/package/async-execute · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
