MCPcopy Create free account
hub / github.com/Sandpack/nodebox-runtime / constructor

Method constructor

packages/nodebox/src/modules/shell.ts:49–64  ·  view source on GitHub ↗
(private readonly channel: MessageSender)

Source from the content-addressed store, hash-verified

47 };
48
49 constructor(private readonly channel: MessageSender) {
50 this.state = 'running';
51 this.stdout = new Emitter();
52 this.stderr = new Emitter();
53 this.stdin = {
54 write: (data: string | Uint8Array): Promise<void> => {
55 if (!this.id) {
56 throw new Error('Failed to write to stdin, no process is currently running');
57 }
58
59 return this.channel.send('shell/stdin', { data: data, workerId: this.id });
60 },
61 };
62
63 this.forwardStdEvents();
64 }
65
66 private forwardStdEvents(): void {
67 this.channel.on('worker/tty', (message) => {

Callers

nothing calls this directly

Calls 2

forwardStdEventsMethod · 0.95
sendMethod · 0.45

Tested by

no test coverage detected