jasongilman / proto-repl

A Clojure Development Environment package for the Atom editor
https://atom.io/packages/proto-repl
MIT License
565 stars 50 forks source link

Uncaught TypeError: Cannot read property 'interrupt' of null #279

Open jpaulorio opened 6 years ago

jpaulorio commented 6 years ago

[Enter steps to reproduce:]

  1. Run command evaluating an infinite list
  2. Try stopping the REPL
  3. Try interrupting the REPL

Atom: 1.20.1 x64 Electron: 1.6.9 OS: Mac OS X 10.12.6 Thrown From: proto-repl package 1.4.21

Stack Trace

Uncaught TypeError: Cannot read property 'interrupt' of null

At /Users/jsilva/.atom/packages/proto-repl/lib/repl.coffee:290

TypeError: Cannot read property 'interrupt' of null
    at Repl.module.exports.Repl.interrupt (/packages/proto-repl/lib/repl.coffee:290:13)
    at Object.interrupt (/packages/proto-repl/lib/proto-repl.coffee:291:12)
    at /packages/proto-repl/lib/proto-repl.coffee:135:35)
    at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (/Applications/Atom.app/Contents/Resources/app/src/command-registry.js:265:35)
    at /Applications/Atom.app/Contents/Resources/app/src/command-registry.js:3:65
    at Object.didConfirmSelection (/Applications/Atom.app/Contents/Resources/app/node_modules/command-palette/lib/command-palette-view.js:106:35)
    at SelectListView.confirmSelection (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-select-list/src/select-list-view.js:313:26)
    at SelectListView.didClickItem (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-select-list/src/select-list-view.js:228:16)
    at ListItemView.onclick (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-select-list/src/select-list-view.js:168:37)
    at ListItemView.didClick (/Applications/Atom.app/Contents/Resources/app/node_modules/atom-select-list/src/select-list-view.js:361:16)

Commands

     -2:22.7.0 proto-repl:execute-block (input.hidden-input)
  3x -2:11.5.0 core:move-up (input.hidden-input)
  5x -2:10.9.0 core:move-left (input.hidden-input)
 18x -2:06.6.0 core:move-right (input.hidden-input)
     -2:01.3.0 core:save (input.hidden-input)
  3x -2:00.1.0 core:move-down (input.hidden-input)
 16x -1:59 core:move-left (input.hidden-input)
     -1:55.6.0 lisp-paredit:slurp-forwards (input.hidden-input)
     -1:54.2.0 core:save (input.hidden-input)
     -1:49.9.0 proto-repl:refresh-namespaces (input.hidden-input)
     -1:45.1.0 proto-repl:execute-block (input.hidden-input)
 11x -1:16.1.0 core:move-left (input.hidden-input)
     -1:13.3.0 core:move-down (input.hidden-input)
  2x -0:57.9.0 proto-repl:exit-repl (input.hidden-input)
     -0:14.7.0 command-palette:toggle (input.hidden-input)
     -0:11.5.0 proto-repl:interrupt (input.hidden-input)

Non-Core Packages

highlight-selected 0.13.1 
ink 0.7.5 
lisp-paredit 0.6.0 
parinfer 1.20.0 
proto-repl 1.4.21 
proto-repl-charts 0.4.1 
set-syntax 0.4.0 
tool-bar 1.1.0 
pedro-w commented 6 years ago

I believe this is not because of interrupting an infinite evaluation but rather sending an interrupt request to a repl that's exited. i.e. can be reproduced by:

  1. Start a repl
  2. Exit the repl
  3. Interrupt (ctrl-shift-C)

In repl.coffee a check should be added so that the interrupt method is not called if the repl isn't running, here . Something like @process?.interrupt() should be OK.