Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REPL breaks on some errors #733

Closed
raine opened this issue May 26, 2015 · 1 comment · Fixed by #929
Closed

REPL breaks on some errors #733

raine opened this issue May 26, 2015 · 1 comment · Fixed by #929

Comments

@raine
Copy link
Contributor

raine commented May 26, 2015

Some errors break a REPL session in such way that it can't be used anymore, arrow keys for browsing history break etc.

This is on 1.4 from npm

$ lsc -d
LiveScript 1.4.0 - use 'lsc --help' for more information
ls> map 1, null

/usr/local/lib/node_modules/livescript/node_modules/prelude-ls/lib/List.js:13
  for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
                        ^
[TypeError: Cannot read property 'length' of null]
ls>


...

undefined
ls> ^[[A^[[A^[[A^[[A^[[A
@raine
Copy link
Contributor Author

raine commented Jun 6, 2015

I had a look at this and can't figure it out.

The exception happens here https://github.com/gkz/LiveScript/blob/master/src/command.ls#L314 and is caught below but it screws up the repl somehow.

A peculiar thing I noticed is that if you ^D after getting an exception with throw \foo, the uncaughtException handler triggers with

TypeError: Cannot read property 'setRawMode' of null
    at ReadStream.setRawMode (tty.js:67:15)
    at Interface._setRawMode (readline.js:177:23)
    at Interface.close (readline.js:286:10)
    at ReadStream.ontermend (readline.js:105:10)
    at ReadStream.emit (events.js:129:20)
    at _stream_readable.js:908:16
    at process._tickDomainCallback (node.js:381:11)

Why is it that throw \foo breaks the repl but this doesn't?

ls> test
[ReferenceError: repl:2
test is not defined]

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

Successfully merging a pull request may close this issue.

1 participant