MCPcopy Create free account
hub / github.com/firebase/firebase-tools / flush

Method flush

src/emulator/types.ts:352–376  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

350 }
351
352 private flush(): void {
353 const nextMsg = EmulatorLog.LOG_BUFFER.shift();
354 if (!nextMsg) {
355 return;
356 }
357
358 EmulatorLog.WAITING_FOR_FLUSH = true;
359 if (process.send) {
360 // For some reason our node.d.ts file does not include the version of subprocess.send() with a callback
361 // but the node docs assert that it has an optional callback.
362 // https://nodejs.org/api/child_process.html#child_process_subprocess_send_message_sendhandle_options_callback
363 (process.send as any)(nextMsg, undefined, {}, (err: any) => {
364 if (err) {
365 process.stderr.write(err);
366 }
367
368 EmulatorLog.WAITING_FOR_FLUSH = EmulatorLog.LOG_BUFFER.length > 0;
369 this.flush();
370 });
371 } else {
372 process.stderr.write(
373 "subprocess.send() is undefined, cannot communicate with Functions Runtime.",
374 );
375 }
376 }
377
378 private toStringCore(pretty = false): string {
379 return JSON.stringify(

Callers 3

logMethod · 0.95
stopMethod · 0.45

Calls 1

writeMethod · 0.80

Tested by

no test coverage detected