node.js - Visual Studio Code redirect input on debug -


my app reading stdin.

var input = process.stdin.read(); 

is possible configure visual studio code redirect input on debug? equal command line:

node app.js < input.txt 

this config not working, debug not starting.

{   "name": "launch",   "type": "node",   "program": "app.js",   "stoponentry": false,   "args": [     "<",     "input.txt"   ] } 

the args array node startup , v8 engine runtime flags.

  --no-deprecation   --throw-deprecation   --trace-deprecation   --v8-options   --max-stack-size=val   --icu-data-dir=dir    --enable-ssl2   --enable-ssl3 

type node --v8-options @ command line see full list of v8 runtime flags.

i'd recommend start app debug flag command line can direct take stdin , attach debugger running process.

> node --debug app.js debugger listening on port 5858 

you can have multiple configurations in launch.json file. add or modify 1 "attach" debug config. attaching, "address" , "port" must specified (please note "address" must set "localhost" since remote debugging not yet supported). port should 1 debug startup process returned above.

enter image description here

once app running on port specified, can change debug target in dropdown next play/run icon.

enter image description here


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -