我希望向node.js的节点检查器调试器输入一组命令,类似于gdb的--command
标志:https://sourceware.org/gdb/current/onlinedocs/gdb/File-Options.html#File-Options。但是,我尝试的所有方法均无效。
使用此bash脚本:
#!/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"
和这个in.txt
:
breakOnUncaught
c
c
q
我的屏幕停滞了:
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
我还尝试用.input
回复https://nodejs.org/api/repl.html的fs.createReadStream
,但收到“只能在暂停时才能执行”错误。
我在:
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$
任何见识都会受到赞赏。