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

TypeError: Bad argument #23

Closed Trudko closed 7 years ago

Trudko commented 9 years ago

Hi, I've tried your package by running JS Example, but I got an error.

Atom Version: 0.182.0 System: Microsoft Windows 7 Professional Thrown From: script-runner package, v1.7.0

Stack Trace

Uncaught TypeError: Bad argument

At child_process.js:1134

TypeError: Bad argument
  at TypeError (native)
  at ChildProcess.spawn (child_process.js:1134:26)
  at Object.exports.spawn (child_process.js:993:9)
  at ScriptRunner.fetchShellEnvironment (C:\Users\Peter\.atom\packages\script-runner\lib\script-runner.coffee:36:26)
  at ScriptRunner.run (C:\Users\Peter\.atom\packages\script-runner\lib\script-runner.coffee:114:6)
  at atom-workspace.atom.commands.add.run:script (C:\Users\Peter\.atom\packages\script-runner\lib\script-runner.coffee:31:33)
  at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (c:\Users\Peter\AppData\Local\atom\app-0.182.0\resources\app\src\command-registry.js:243:29)
  at c:\Users\Peter\AppData\Local\atom\app-0.182.0\resources\app\src\command-registry.js:3:61
  at CommandPaletteView.module.exports.CommandPaletteView.confirmed (c:\Users\Peter\AppData\Local\atom\app-0.182.0\resources\app\node_modules\command-palette\lib\command-palette-view.js:120:32)
  at CommandPaletteView.module.exports.SelectListView.confirmSelection (c:\Users\Peter\AppData\Local\atom\app-0.182.0\resources\app\node_modules\atom-space-pen-views\lib\select-list-view.js:338:21)
  at space-pen-div.atom.commands.add.core:confirm (c:\Users\Peter\AppData\Local\atom\app-0.182.0\resources\app\node_modules\atom-space-pen-views\lib\select-list-view.js:109:19)
  at CommandRegistry.module.exports.CommandRegistry.handleCommandEvent (c:\Users\Peter\AppData\Local\atom\app-0.182.0\resources\app\src\command-registry.js:243:29)
  at c:\Users\Peter\AppData\Local\atom\app-0.182.0\resources\app\src\command-registry.js:3:61
  at KeymapManager.module.exports.KeymapManager.dispatchCommandEvent (c:\Users\Peter\AppData\Local\atom\app-0.182.0\resources\app\node_modules\atom-keymap\lib\keymap-manager.js:558:16)
  at KeymapManager.module.exports.KeymapManager.handleKeyboardEvent (c:\Users\Peter\AppData\Local\atom\app-0.182.0\resources\app\node_modules\atom-keymap\lib\keymap-manager.js:396:22)
  at HTMLDocument.module.exports.WindowEventHandler.onKeydown (c:\Users\Peter\AppData\Local\atom\app-0.182.0\resources\app\src\window-event-handler.js:176:20)

Commands

     -0:40.0 core:backspace (atom-text-editor.editor.mini)
     -0:38.3 core:select-all (atom-text-editor.editor.mini)
     -0:35.8 core:confirm (atom-text-editor.editor.mini)
     -0:10.4 core:close (div.settings-view.pane-item)
     -0:08.9 command-palette:toggle (atom-text-editor.editor)
     -0:07.9 core:confirm (atom-text-editor.editor.mini)
     -0:07.9 run:script (atom-text-editor.editor)

Config

{
  "core": {
    "disabledPackages": [
      "linter-phpcs",
      "turbo-javascript",
      "jslint",
      "preview-plus",
      "linter-jshint",
      "jshint"
    ]
  }
}

Installed Packages

# User
script-runner, v1.7.0

# Dev
No dev packages
huba commented 9 years ago

This could be an issue with node. However I will have a look.

ioquatix commented 9 years ago

This might be an issue with Windows support which is largely untested. It's something we'd like to support but the options right now are pretty bleak (i.e. pty support)

huba commented 9 years ago

Yea. I can't really do much to test this part atm, however this stack trace looks suspiciously similar to one you would get if you called ChildProcess.spawn with something that can't be executed. My best guess is that there might not be a SHELL environment variable on Windows.

@Trudko could you please run:

SET SHELL

in cmd and post the output? (if there is any)

Trudko commented 9 years ago

SHELL variable isn't available.

sustained commented 9 years ago

No updates on this?

ioquatix commented 9 years ago

This would be an awesome feature, please feel free to submit a PR. Otherwise, we will slowly work towards this goal. Unfortunately most of us have real jobs, families or education to attend to :D

darkgrunge commented 8 years ago

Does anybody know if this issue has been resolved? I'm trying to run a python script on widows and I'm getting the following error:

TypeError: Bad argument at TypeError (native) at ChildProcess.spawn (internal/child_process.js:274:26) at Object.exports.spawn (child_process.js:351:9)

Not sure if it's the same problem, or similar.

huba commented 8 years ago

@darkgrunge what version of script-runner are you using? This was originally an issue with environment extraction on Windows. From v1.8.1 we moved this functionality over to a different package called shell-environment which uses process.env when a user shell is not available and script-runner now relies on that.

ioquatix commented 7 years ago

We just released 2.0.0 which has no specific platform code in it. In theory, it should work on windows.. can anyone try it out?

ioquatix commented 7 years ago

If this is still an issue let me know.