Page MenuHomePhabricator

D11258.id37894.diff
No OneTemporary

D11258.id37894.diff

diff --git a/scripts/set-user-credentials.js b/scripts/set-user-credentials.js
--- a/scripts/set-user-credentials.js
+++ b/scripts/set-user-credentials.js
@@ -4,11 +4,23 @@
const fs = require('fs');
const readline = require('readline');
+const Writable = require('stream').Writable;
+
+let silenceOutput = false;
+
+const outStream = new Writable({
+ write: function (chunk, encoding, callback) {
+ if (!silenceOutput) {
+ process.stdout.write(chunk, encoding);
+ }
+ callback();
+ },
+});
-// Create an interface for reading input
const rl = readline.createInterface({
input: process.stdin,
- output: process.stdout,
+ output: outStream,
+ terminal: true,
});
const data = {};
@@ -17,13 +29,17 @@
data.username = value1;
rl.question('password: ', value2 => {
- data.password = value2;
+ silenceOutput = false;
+ rl.output.write('\n');
+ data.password = value2;
writeFiles(data);
// Close the readline interface
rl.close();
});
+
+ silenceOutput = true;
});
function writeFiles(credentials) {

File Metadata

Mime Type
text/plain
Expires
Sun, Dec 22, 7:25 AM (6 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2689817
Default Alt Text
D11258.id37894.diff (1 KB)

Event Timeline