Skip to content
This repository has been archived by the owner on Nov 3, 2022. It is now read-only.

Debugger throwing error #56

Closed
shaycraft opened this issue Apr 18, 2017 · 7 comments
Closed

Debugger throwing error #56

shaycraft opened this issue Apr 18, 2017 · 7 comments

Comments

@shaycraft
Copy link

shaycraft commented Apr 18, 2017

Sort of similar to issue #25. Whenever I run something with readline-sync with the --debug flag, a script that runs fine without it gives this error:
src\debug-agent.cc:149: Assertion(err) == (0)' failed.`

This is under node 6.10.1, npm 3.10.10. It does this on my home computer (Windows 10) and work as well (Windows 7): Simplest steps to reproduce:

create a file main.js containing this line:
var rl = require('readline-sync');

run with node main.js should be no errors.
run with node --debug main.js and results in the above mentioned error.

UPDATE: Verified too that this happens in Linux as well under node 7.7, same error.

@anseki
Copy link
Owner

anseki commented Apr 18, 2017

Hi @shaycraft, thank you for the comment.

So, is that message an error that means that your script was aborted?
I tried a script with --debug, and it worked fine with that message.
(The layout is broken in your debug agent because readlineSync uses TTY.)

@shaycraft
Copy link
Author

The script does not abort and does run correctly with the --debug option, but I cannot debug which is the issue. I suppose what you are saying about TTY makes sense, wonder if there is a way around this.

@anseki
Copy link
Owner

anseki commented Apr 18, 2017

Do you mean that your debugger such as node inspector doesn't work?

@shaycraft
Copy link
Author

Right, in this case I'm using VS Code. It times out and says it's unresponsive, which I assume is because of the tty.

@anseki
Copy link
Owner

anseki commented Apr 18, 2017

I see.
Since readlineSync is a module to read/write TTY, of course it doesn't work in environment that has no TTY.
I.e. that is a correct behavior.

You have to emulate input via TTY if you want to run it for debugging without TTY. For example, you can use stubs and mocks via library such as Sinon.JS for unit testing.

@shaycraft
Copy link
Author

Cool I'll look into it. I'll close this issue then.

@anseki
Copy link
Owner

anseki commented Apr 18, 2017

😄

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants