MCPcopy Create free account
hub / github.com/NativeScript/android / onStdinData

Function onStdinData

build-artifacts/scripts/release-notes.js:233–267  ·  view source on GitHub ↗
(ch)

Source from the content-addressed store, hash-verified

231 stdin.on('data', onStdinData);
232
233 function onStdinData(ch) {
234 ch = ch + "";
235
236 switch (ch) {
237 case "\n":
238 case "\r":
239 case "\u0004":
240 // They've finished typing their password
241 process.stdout.write('\n');
242 stdin.setRawMode(false);
243 stdin.pause();
244 callback(password);
245 stdin.removeListener('data', onStdinData);
246 break;
247 case "\u0003":
248 // Ctrl-C
249 console.log("Canceled.");
250 process.exit(1);
251 break;
252 case "\u007F":
253 // Backspace
254 if (password.length > 0) {
255 password = password.substring(0, password.length - 1);
256 process.stdout.write('*\033[<1>D');
257 } else {
258 process.stdout.write(' \033[<1>D');
259 }
260 break;
261 default:
262 // More passsword characters
263 process.stdout.write('*\033[<1>D');
264 password += ch;
265 break;
266 }
267 }
268}
269

Callers

nothing calls this directly

Calls 5

callbackFunction · 0.85
pauseMethod · 0.80
substringMethod · 0.80
writeMethod · 0.65
logMethod · 0.65

Tested by

no test coverage detected