| 41 | const io = new Transform({ |
| 42 | encoding: 'utf-8', |
| 43 | transform(chunk, encoding, respond) { |
| 44 | chunk = chunk.toString(); |
| 45 | // Uncomment to see CLI output during test |
| 46 | // process.stdout.write(chunk); |
| 47 | |
| 48 | const isStep = chunk.endsWith(OUTPUT_END_SEQ) || step == stepInputs.length - 1; // viewing mnemonic (vim) |
| 49 | if (isStep) { |
| 50 | for (const input of stepInputs[step]) { |
| 51 | this.push(input); |
| 52 | } |
| 53 | step++; |
| 54 | } else if (chunk.includes('Error:')) { |
| 55 | return respond(chunk); |
| 56 | } else if (chunk.endsWith(' created successfully!\n\n')) { |
| 57 | child.stdin.end(); // send EOF to child so it can exit cleanly |
| 58 | } |
| 59 | respond(); |
| 60 | } |
| 61 | }); |
| 62 | const child = spawn('node', [CLI_EXEC, walletName, ...commonOpts], CLI_OPTS); |
| 63 | child.stderr.pipe(helpers.filterStderr()).pipe(process.stderr); |