ioquatix / script-runner

This package will run various script files inside of Atom. It currently supports JavaScript, CoffeeScript, Ruby, and Python. You can add more.
http://atom.io/packages/script-runner
Other
62 stars 23 forks source link

Uncaught Error: Can't save destroyed buffer #78

Closed ioquatix closed 7 years ago

ioquatix commented 7 years ago

[Enter steps to reproduce:]

  1. Run an example script.
  2. Close script and output window.
  3. Open and run an example script.
  4. Repeat this process, eventually it tries to save the same script as it's executing.

Atom: 1.19.0 x64 Electron: 1.6.9 OS: Mac OS X 10.12.6 Thrown From: script-runner package 2.1.2

Stack Trace

Uncaught Error: Can't save destroyed buffer

At /Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:1180

Error: Can't save destroyed buffer
    at TextBuffer.module.exports.TextBuffer.saveTo (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:1180:21)
    at TextBuffer.module.exports.TextBuffer.save (/Applications/Atom.app/Contents/Resources/app/node_modules/text-buffer/lib/text-buffer.js:1167:25)
    at TextEditor.module.exports.TextEditor.save (/Applications/Atom.app/Contents/Resources/app/src/text-editor.js:1003:32)
    at ScriptRunnerProcess.module.exports.ScriptRunnerProcess.resolvePath (/packages/script-runner/lib/script-runner-process.coffee:44:30)
    at ScriptRunnerProcess.module.exports.ScriptRunnerProcess.execute (/packages/script-runner/lib/script-runner-process.coffee:85:21)
    at Function.module.exports.ScriptRunnerProcess.run (/packages/script-runner/lib/script-runner-process.coffee:14:25)
    at /packages/script-runner/lib/script-runner.coffee:149:46
    at /packages/script-runner/node_modules/shell-environment/lib/index.js:39:20
    at /packages/script-runner/node_modules/shell-environment/lib/index.js:49:18
    at /packages/script-runner/node_modules/shell-environment/lib/index.js:81:18)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:191:7)
    at maybeClose (internal/child_process.js:885:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)

Commands

Non-Core Packages

escape-utils 0.5.3 
file-icons 2.1.3 
language-latex 1.0.0 
language-openscad 0.4.3 
language-trenni 0.2.1 
nuclide 0.229.0 
script-runner 2.1.2 
tab-control 0.6.10 
tabs-to-spaces 1.0.3 
ioquatix commented 7 years ago

@huba Do you think you can see if you can figure this out?

ioquatix commented 7 years ago

I think the problem is, it's selecting the wrong pane.

ioquatix commented 7 years ago

The order matters, you must close the script pane first, then the script output pane. I think then, when you open the script the 2nd time, it opens in the same pane as the previous output.

ioquatix commented 7 years ago

I wonder if we should explore using Panels: https://atom.io/docs/api/v0.189.0/Panel

huba commented 7 years ago

I think I do have an experimental branch somewhere with panels. https://github.com/huba/script-runner/commit/daab3abd5d3fcfea1e64801b9007550522b9803f

ioquatix commented 7 years ago

Okay this should be fixed in the latest release, since I moved from Panes to Panels, and now atom manages this.