AtomLinter / linter-cpplint

Linter plugin for c++, using cpplint
https://atom.io/packages/linter-cpplint
MIT License
6 stars 5 forks source link

Error: spawn UNKNOWN #49

Closed JamesCoyle closed 7 years ago

JamesCoyle commented 8 years ago
Error: spawn UNKNOWN
    at exports._errnoException (util.js:856:11)
    at ChildProcess.spawn (internal/child_process.js:298:11)
    at exports.spawn (child_process.js:374:9)
    at C:\Users\Solus\.atom\packages\linter-cpplint\node_modules\atom-linter\node_modules\sb-exec\lib\index.js:15:53
    at Object.<anonymous> (C:\Users\Solus\.atom\packages\linter-cpplint\node_modules\atom-linter\node_modules\sb-exec\lib\index.js:14:18)
    at [object Generator].next (native)
    at step (C:\Users\Solus\.atom\packages\linter-cpplint\node_modules\atom-linter\node_modules\sb-exec\lib\index.js:84:191)
    at C:\Users\Solus\.atom\packages\linter-cpplint\node_modules\atom-linter\node_modules\sb-exec\lib\index.js:84:368

Seem to be having quite a few issues getting this to work. :/

Arcanemagus commented 8 years ago

To get this working on Windows you need to create a wrapper batch file that executes cpplint.py through Python, passing in the arguments to it. Then set the full path to that script as the executable path option.

JamesCoyle commented 8 years ago

cpplint.py seems to be running via python. I swear I had this running before without having to change any settings or do anything. I just installed python, installed linter-cpplint and it worked no problem.

Arcanemagus commented 8 years ago

Hmmm, actually if you had previously added .py to your PATHEXT then that would explain how it was working before "no problem". There was a bug in a dependency used to actually perform the execution that could have broken this.

To fix that, if that is the issue, go through the following:

  1. Close Atom
  2. Go to C:\Users\Solus\.atom\packages and delete/move all linter-____ folders, making sure to note the names
  3. Run apm install linter-name1 linter-name2 ... to run a fresh install of the packages previously removed

This should force all the sub-dependencies to be the latest allowed version, bringing in the fixed version of sb-exec.

olee commented 8 years ago

Same here on windows. This linter fails to properly launch the process because it tries to launch a script and not an executable. This can be fixed by changing this code here to this one:

        parameters.splice(0, 0, @cpplintPath)
        return helpers
            .exec('python', parameters, stream: 'stderr').then (result) ->

The other solution is placing a .bat or .cmd file in the same directory as the python script with the following content and referencing it in the plugin config:

python %~dp0cpplint.py %*
Arcanemagus commented 8 years ago

The odd thing about all of this is when you install cpplint, it should have already created a cpplint.exe in your Scripts folder. What do you get from running where.exe cpplint? It should be similar to C:\Python27\Scripts\cpplint.exe.

JamesCoyle commented 8 years ago

My issue at the moment is that I uninstalled it but Atom still thinks it's installed. It won't uninstall it because there aren't any files to uninstall and it doesn't let me install it as it thinks it's installed already. I don't remember if I actually installed python before installing Atom though so that might be why it didn't install the executable in the right place.

olee commented 8 years ago

Eh.... install cpplint? I just downloaded the python file. I didn't really find any download for some kind of installer.

Arcanemagus commented 8 years ago

@olee Ah, pip install cpplint will install it properly and setup all the standard wrapper scripts. If you are manually downloading the .py file you would need to create the wrapper like you mentioned.

@JamesCoyle I'm not entirely sure what you mean by "it", if you mean this package then simply close Atom and delete the C:\Users\Solus\.atom\packages\linter-cpplint folder.

JamesCoyle commented 7 years ago

Managed to get this working again now. Not sure what issue I was having that wouldn't let me install it again but that seems to be fixed now. I've now just set the executable path to be C:\Python27\Scripts\cpplint.exe which works fine. The batch file method also works.