https://github.com/ratson/deno-subprocess
Capture command output wihtout boilerplate
https://github.com/ratson/deno-subprocess
child-process deno subprocess
Last synced: about 2 months ago
JSON representation
Capture command output wihtout boilerplate
- Host: GitHub
- URL: https://github.com/ratson/deno-subprocess
- Owner: ratson
- Created: 2020-11-23T16:14:15.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-23T16:22:22.000Z (over 5 years ago)
- Last Synced: 2025-03-26T01:33:37.760Z (about 1 year ago)
- Topics: child-process, deno, subprocess
- Language: TypeScript
- Homepage:
- Size: 1.95 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## ❯ Content
- [❯ Content](#-content)
- [❯ Install](#-install)
- [❯ Usage](#-usage)
- [output()](#output)
- [stderrOutput()](#stderroutput)
- [run()](#run)
## ❯ Install
This module can be imported directly from the repo and from following registries.
Deno Registry
```typescript
import * as subprocess from "https://deno.land/x/subprocess/mod.ts";
```
Github
```typescript
import * as subprocess from "https://raw.githubusercontent.com/ratson/deno-subprocess/master/mod.ts";
```
## ❯ Usage
### output()
Capture stdout output from a command.
```typescript
import * as subprocess from "https://deno.land/x/subprocess/mod.ts";
const stdout: string = await subprocess.output(["deno", "--version"]);
```
### stderrOutput()
Capture stderr output from a command.
```typescript
import * as subprocess from "https://deno.land/x/subprocess/mod.ts";
const stderr: string = await subprocess.stderrOutput(["deno", "--version"]);
```
### run()
Run a command.
```typescript
import * as subprocess from "https://deno.land/x/subprocess/mod.ts";
const { code, success } = await subprocess.run(["deno", "--version"]);
```
Run a command without printing to stdout and stderr.
```typescript
import * as subprocess from "https://deno.land/x/subprocess/mod.ts";
const result = await subprocess.run(["deno", "--version"], { stderr: "null", stdout: "null" });
```
Run a command with captured output.
```typescript
import * as subprocess from "https://deno.land/x/subprocess/mod.ts";
const result = await subprocess.run(["deno", "--version"], { stderr: "piped", stdout: "piped" });
const { code, success, stderr, stdout } = result
```