bare-process
Advanced tools
+5
-5
@@ -13,4 +13,4 @@ import abort from 'bare-abort' | ||
| } from 'bare-os' | ||
| import { ReadStream } from 'bare-tty' | ||
| import Pipe from 'bare-pipe' | ||
| import tty from 'bare-tty' | ||
| import fs from 'bare-fs' | ||
| import hrtime from 'bare-hrtime' | ||
@@ -36,5 +36,5 @@ | ||
| interface Process<M extends ProcessEvents = ProcessEvents> extends EventEmitter<M> { | ||
| readonly stdin: ReadStream | Pipe | ||
| readonly stdout: ReadStream | Pipe | ||
| readonly stderr: ReadStream | Pipe | ||
| readonly stdin: tty.ReadStream | fs.ReadStream | ||
| readonly stdout: tty.WriteStream | fs.WriteStream | ||
| readonly stderr: tty.WriteStream | fs.WriteStream | ||
@@ -41,0 +41,0 @@ readonly arch: ReturnType<typeof arch> |
+20
-17
| const abort = require('bare-abort') | ||
| const EventEmitter = require('bare-events') | ||
| const Pipe = require('bare-pipe') | ||
| const Signal = require('bare-signals') | ||
| const tty = require('bare-tty') | ||
| const fs = require('bare-fs') | ||
| const os = require('bare-os') | ||
@@ -10,6 +10,2 @@ const env = require('bare-env') | ||
| let stdin = null | ||
| let stdout = null | ||
| let stderr = null | ||
| class Process extends EventEmitter { | ||
@@ -19,2 +15,6 @@ constructor() { | ||
| this._stdin = null | ||
| this._stdout = null | ||
| this._stderr = null | ||
| this._startTime = hrtime.bigint() | ||
@@ -41,26 +41,29 @@ | ||
| get stdin() { | ||
| if (stdin === null) { | ||
| stdin = tty.isTTY(0) ? new tty.ReadStream(0) : new Pipe(0, { eagerOpen: false }) | ||
| stdin.fd = 0 | ||
| if (this._stdin === null) { | ||
| this._stdin = tty.isTTY(0) | ||
| ? new tty.ReadStream(0) | ||
| : fs.createReadStream(null, { fd: 0, eagerOpen: false }) | ||
| } | ||
| return stdin | ||
| return this._stdin | ||
| } | ||
| get stdout() { | ||
| if (stdout === null) { | ||
| stdout = tty.isTTY(1) ? new tty.WriteStream(1) : new Pipe(1, { eagerOpen: false }) | ||
| stdout.fd = 1 | ||
| if (this._stdout === null) { | ||
| this._stdout = tty.isTTY(1) | ||
| ? new tty.WriteStream(1) | ||
| : fs.createWriteStream(null, { fd: 1, eagerOpen: false }) | ||
| } | ||
| return stdout | ||
| return this._stdout | ||
| } | ||
| get stderr() { | ||
| if (stderr === null) { | ||
| stderr = tty.isTTY(2) ? new tty.WriteStream(2) : new Pipe(2, { eagerOpen: false }) | ||
| stderr.fd = 2 | ||
| if (this._stderr === null) { | ||
| this._stderr = tty.isTTY(2) | ||
| ? new tty.WriteStream(2) | ||
| : fs.createWriteStream(null, { fd: 2, eagerOpen: false }) | ||
| } | ||
| return stderr | ||
| return this._stderr | ||
| } | ||
@@ -67,0 +70,0 @@ |
+2
-2
| { | ||
| "name": "bare-process", | ||
| "version": "4.3.0", | ||
| "version": "4.4.0", | ||
| "description": "Node.js-compatible process control for Bare", | ||
@@ -39,5 +39,5 @@ "exports": { | ||
| "bare-events": "^2.3.1", | ||
| "bare-fs": "^4.5.6", | ||
| "bare-hrtime": "^2.0.0", | ||
| "bare-os": "^3.7.1", | ||
| "bare-pipe": "^4.0.0", | ||
| "bare-signals": "^4.0.0", | ||
@@ -44,0 +44,0 @@ "bare-tty": "^5.0.0" |
18141
0.82%231
1.32%+ Added
+ Added
+ Added
+ Added
- Removed
- Removed