MCPcopy Index your code
hub / github.com/nodejs/node / repl

Function repl

lib/internal/debugger/inspect_repl.js:1119–1169  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1117 },
1118
1119 get repl() {
1120 // Don't display any default messages
1121 const listeners = ArrayPrototypeSlice(repl.listeners('SIGINT'));
1122 repl.removeAllListeners('SIGINT');
1123
1124 const oldContext = repl.context;
1125
1126 exitDebugRepl = () => {
1127 // Restore all listeners
1128 process.nextTick(() => {
1129 ArrayPrototypeForEach(listeners, (listener) => {
1130 repl.on('SIGINT', listener);
1131 });
1132 });
1133
1134 // Exit debug repl
1135 repl.eval = controlEval;
1136
1137 // Swap history
1138 history.debug = repl.history;
1139 repl.history = history.control;
1140
1141 repl.context = oldContext;
1142 repl.setPrompt('debug> ');
1143 repl.displayPrompt();
1144
1145 repl.removeListener('SIGINT', exitDebugRepl);
1146 repl.removeListener('exit', exitDebugRepl);
1147
1148 exitDebugRepl = null;
1149 };
1150
1151 // Exit debug repl on SIGINT
1152 repl.on('SIGINT', exitDebugRepl);
1153
1154 // Exit debug repl on repl exit
1155 repl.on('exit', exitDebugRepl);
1156
1157 // Set new
1158 repl.eval = debugEval;
1159 repl.context = {};
1160
1161 // Swap history
1162 history.control = repl.history;
1163 repl.history = history.debug;
1164
1165 repl.setPrompt('> ');
1166
1167 print('Press Ctrl+C to leave debug repl');
1168 return repl.displayPrompt();
1169 },
1170
1171 get version() {
1172 return PromisePrototypeThen(Runtime.evaluate({

Callers

nothing calls this directly

Calls 6

displayPromptMethod · 0.80
printFunction · 0.70
removeAllListenersMethod · 0.45
onMethod · 0.45
setPromptMethod · 0.45
removeListenerMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…