MCPcopy Create free account
hub / github.com/Marus/cortex-debug / write

Method write

src/frontend/pty.ts:496–520  ·  view source on GitHub ↗
(data: string | Buffer)

Source from the content-addressed store, hash-verified

494 }
495
496 public write(data: string | Buffer) {
497 if (!this.terminal) { // Writes after a terminal is closed
498 return;
499 }
500 if (!this.isReady) {
501 this.pendingWrites.push(data);
502 return;
503 }
504 try {
505 this.unPrompt();
506 if ((typeof data !== 'string') && !(data instanceof String)) {
507 data = data.toString('utf8');
508 }
509 data = data.replace(/[\r]?\n/g, '\r\n');
510 this.writeEmitter.fire(data);
511 if (data.endsWith('\n')) {
512 this.doPrompt();
513 } else if (this.promptTimer) {
514 this.promptTimer.kill();
515 }
516 }
517 catch (e) {
518 console.error(`MyPtyTerminal: write: ${e}`);
519 }
520 }
521
522 // When we prompt, we not only write the prompt but also any remaining input
523 protected doPrompt() {

Callers 15

onOpenMethod · 0.95
resetOptionsMethod · 0.95
writeWithHeaderMethod · 0.95
tclSendDataMethod · 0.45
handleObjectFunction · 0.45
writeHeaderFunction · 0.45
packageJSONtoMdFunction · 0.45
newBackendConnectionMethod · 0.45
sendToBackendMethod · 0.45
onCloseMethod · 0.45
writeNonBinaryMethod · 0.45
sendDataMethod · 0.45

Calls 5

unPromptMethod · 0.95
doPromptMethod · 0.95
toStringMethod · 0.80
fireMethod · 0.80
killMethod · 0.45

Tested by

no test coverage detected