# @utilx/process

Latest version **0.0.9** (published 2019-05-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install @utilx/process
pnpm add @utilx/process
yarn add @utilx/process
bun add @utilx/process
```

## Health

**Score 25/100 (F)** — status: abandoned.

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

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.9 |
| Published | 2019-05-16 |
| First published | 2019-04-03 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 23.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | lteam |

## Links

- npm: https://www.npmjs.com/package/@utilx/process
- Repository: https://github.com/edwinjhlee/process-utils
- Homepage: https://github.com/edwinjhlee/process-utils#readme
- Issues: https://github.com/edwinjhlee/process-utils/issues
- npm.io page: https://npm.io/package/@utilx/process

## Dependencies (3)

- [@utilx/stream](https://npm.io/package/@utilx/stream.md) latest
- [@utilx/promise](https://npm.io/package/@utilx/promise.md) latest
- [@utilx/iterator](https://npm.io/package/@utilx/iterator.md) latest

## Recent versions

- 0.0.9 (latest) — 2019-05-16
- 0.0.8 — 2019-05-07
- 0.0.7 — 2019-04-12
- 0.0.6 — 2019-04-12
- 0.0.5 — 2019-04-12
- 0.0.4 — 2019-04-11
- 0.0.3 — 2019-04-09
- 0.0.2 — 2019-04-05
- 0.0.1 — 2019-04-05
- 0.0.0 — 2019-04-03

## README

# process-utils


```typescript
import r from "process-utils"

async function main(){
    const { code, stdout, stderr } = await r("echo hi")
    if (code === 0) console.log(stdout)

    r$("echo hi")
    r$.ctx.code = 0
    console.log(ctx.pid, ctx.status)
    
    const p = await ra("echo hi")
    r("echo hi")

    await npm.install.save_dev("fs-extra", "numpy")
    
    npm.install.save_dev$("fs-extra", "numpy")

    r$("apt install ")

    r$("apt install vim emacs -y")
    r$("brew install markdown")
    r$("yum install vim -y")

    const { error, pid, status, code, signal } = await npm.install.save("fs-extra")
    const { error, pid. status, code, signal } = npm.install.save$("fs-extra")
    const npm_res = await npm.install("fs-extra")

    npm.install.save$("fs-extra").pipe( awk.check$("") )

    const p1 = await npm.install.save$("fs-extra").throwError()
    npm.install.save("fs-extra")

    console.log(npm_res.pid, npm_res.status)

    apt.install.yes$("vim")
    console.log(ctx.pid, ctx.status)

    await apt.install("vim")
    console.log("visualized")

    apt.install_("vim")
    apt.install("vim").toString_() // promise design

    apt.install("vim") // promise design

}

```

关于result的设计，我们默认需要用户写防御式代码

```typescript
const result = processinstance.get()
"code" in result && console.log(result.code)
if ("code" in result) {
    console.log(result.code, result.signal)
}
```

另外一种写法是，用户很确定这里不会有问题，否则程序会以ERROR方式中断

```typescript
const result = processinstance.getOrThrow() // no Error
console.log(result.code, result.signal)
```

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