Skip to content

Commit d10087b

Browse files
committed
Wait for stdin
1 parent 51829ef commit d10087b

File tree

1 file changed

+17
-14
lines changed

1 file changed

+17
-14
lines changed

scripts/run-ci-e2e-tests.js

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -100,20 +100,23 @@ try {
100100
'npm adduser --registry http://localhost:4873',
101101
);
102102

103-
child.stdout.on('data', d => {
104-
const data = d.toString();
105-
process.stdout.write(d + '\n');
106-
if (data.match(/username/i)) {
107-
echo('Write username to child');
108-
child.stdin.write('user' + '\n');
109-
} else if (data.match(/password/i)) {
110-
child.stdin.write('pass' + '\n');
111-
} else if (data.match(/email/i)) {
112-
child.stdin.write('[email protected]' + '\n');
113-
} else if (data.match(/logged in as/i)) {
114-
echo('Logged in as user');
115-
child.stdin.end();
116-
}
103+
await new Promise(resolve => {
104+
child.stdout.on('data', d => {
105+
const data = d.toString();
106+
process.stdout.write(d + '\n');
107+
if (data.match(/username/i)) {
108+
echo('Write username to child');
109+
child.stdin.write('user' + '\n');
110+
} else if (data.match(/password/i)) {
111+
child.stdin.write('pass' + '\n');
112+
} else if (data.match(/email/i)) {
113+
child.stdin.write('[email protected]' + '\n');
114+
} else if (data.match(/logged in as/i)) {
115+
echo('Logged in as user');
116+
child.stdin.end();
117+
resolve(undefined);
118+
}
119+
});
117120
});
118121

119122
echo('Publish package');

0 commit comments

Comments
 (0)