summaryrefslogtreecommitdiff
path: root/test/sequential/test-debug-prompt.js
blob: e32f464690053670e530563372dd943c718b4040 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
'use strict';

const common = require('../common');
common.skipIfInspectorDisabled();
const spawn = require('child_process').spawn;

const proc = spawn(process.execPath, ['inspect', 'foo']);
proc.stdout.setEncoding('utf8');

let needToSendExit = true;
let output = '';
proc.stdout.on('data', (data) => {
  output += data;
  if (output.includes('debug> ') && needToSendExit) {
    proc.stdin.write('.exit\n');
    needToSendExit = false;
  }
});