Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 139893

How can I script / automate node.js's node-inspector debugger by giving a sequence of commands similar to gdb's --command flag?

$
0
0

I wish to input a set of commands to node.js's node-inspector debugger similar to gdb's --command flag: https://sourceware.org/gdb/current/onlinedocs/gdb/File-Options.html#File-Options. However, everything I tried didn't work.

Using this bash script:

#!/usr/bin/env bash
set -e -x
gmake
export NODE_PATH="`pwd`"/lib/for-node/js NODE_NO_READLINE=1
node-inspect ./qunit.js lib/for-node/test-code-emcc.js < "./in.txt"

and this in.txt:

breakOnUncaught
c
c
q

I get a stuck screen:

shlomif[fcs]:$trunk/fc-solve/site/wml$ bash run2.bash
+ gmake
gmake: Nothing to be done for 'all'.
++ pwd
+ export NODE_PATH=/home/shlomif/progs/freecell/git/fc-solve/fc-solve/site/wml/lib/for-node/js NODE_NO_READLINE=1
+ NODE_PATH=/home/shlomif/progs/freecell/git/fc-solve/fc-solve/site/wml/lib/for-node/js
+ NODE_NO_READLINE=1
+ node-inspect ./qunit.js lib/for-node/test-code-emcc.js
< Debugger listening on ws://127.0.0.1:9229/763692eb-cf00-4e5e-8ef8-259bcfe6bd90
< For help, see: https://nodejs.org/en/docs/inspector
< Debugger attached.
Break on start in qunit.js:5
  3 "use strict";
  4 
> 5 const program = require( "commander" );
  6 const path = require( "path" );
  7 
debug> ^C

I also tried replying https://nodejs.org/api/repl.html's .input with fs.createReadStream but got "can only do that when paused" errors.

I am on:

shlomif[fcs]:$trunk/fc-solve/site/wml$ node --version
v12.9.1
shlomif[fcs]:$trunk/fc-solve/site/wml$ uname -a
Linux telaviv1.shlomifish.org 5.4.2-desktop-2.mga8 #1 SMP Mon Dec 9 16:22:44 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
shlomif[fcs]:$trunk/fc-solve/site/wml$ 

Any insight will be appreciated.


Viewing all articles
Browse latest Browse all 139893

Trending Articles