Skip to content

Commit

Permalink
added ability to set stdin
Browse files Browse the repository at this point in the history
  • Loading branch information
calvinrp committed Nov 5, 2024
1 parent eb9b10b commit 7db547a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions packages/preview2-shim/lib/browser-async/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,21 @@ import { _setCwd as fsSetCwd } from './filesystem.js';

const textDecoder = new TextDecoder();

let stdinStream, stdoutStream, stderrStream;
let _env = [], _args = [], _cwd = "/";
export function _setEnv (envObj) {
_env = Object.entries(envObj);
}
export function _setArgs (args) {
_args = args;
}

export function _setCwd (cwd) {
fsSetCwd(_cwd = cwd);
}
export function _setStdin (stream) {
stdinStream = stream;
}


export const environment = {
getEnvironment () {
Expand Down Expand Up @@ -44,7 +48,6 @@ export const exit = {
}
};

let stdinStream;
export const stdin = {
InputStream,
getStdin () {
Expand All @@ -55,7 +58,6 @@ export const stdin = {
}
};

let stdoutStream;
export const stdout = {
OutputStream,
getStdout () {
Expand All @@ -76,7 +78,6 @@ export const stdout = {
}
};

let stderrStream;
export const stderr = {
OutputStream,
getStderr () {
Expand Down

0 comments on commit 7db547a

Please sign in to comment.