MCPcopy Create free account
hub / github.com/Noumena-Network/code / createCapturedConsole

Function createCapturedConsole

src/tools/REPLTool/javascriptReplFactory.tsx:162–184  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

160}
161
162function createCapturedConsole(): CapturedConsole {
163 const stdout: string[] = []
164 const stderr: string[] = []
165 const writeStdout = (...args: unknown[]) => {
166 stdout.push(formatConsoleArgs(args))
167 }
168 const writeStderr = (...args: unknown[]) => {
169 stderr.push(formatConsoleArgs(args))
170 }
171 return {
172 log: writeStdout,
173 info: writeStdout,
174 debug: writeStdout,
175 warn: writeStderr,
176 error: writeStderr,
177 getStdout: () => stdout.join('\n'),
178 getStderr: () => stderr.join('\n'),
179 clear: () => {
180 stdout.length = 0
181 stderr.length = 0
182 },
183 }
184}
185
186function createVmExecutionContext(capturedConsole: CapturedConsole): Context {
187 const vmContext = createContext({

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected