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

Linter stuck on non-existent temp file "Can't execute command:" #27

Open
Zap0 opened this issue Jun 7, 2023 · 5 comments
Open

Linter stuck on non-existent temp file "Can't execute command:" #27

Zap0 opened this issue Jun 7, 2023 · 5 comments

Comments

@Zap0
Copy link

Zap0 commented Jun 7, 2023

I closed NP++ once while a temp file existed, and deleted it manually while NP++ was closed. Now the linter does not lint anything anymore, constantly giving an error message about being unable to lint the temp file I deleted. Relaunching NP++, reinstalling the plugin and rebooting do nothing.

image

my linter.xml:

<NotepadPlus>
  <linter extension=".js" command="C:\PROGRA~1\nodejs\eslint --format checkstyle"/>
</NotepadPlus>

running the command and paths manually in cmd works, and the linter has worked before this happened.

@andrija-naglic
Copy link

I have the same issue, except I haven't manually deleted anything.
My linter never worked in the first place, I'm having trouble getting passed the "Can't execute command" in the first place.
It seems that the .temp.linter.file.tmp never gets created in the first place, and the stdin="1" attribute didn't help with that - the plugin still tries to open the same temp file.

@andrija-naglic
Copy link

Ok, I've solved my problem.

I wasn't using eslint but phpcs and the way I got it working was to call a batch file.
That batch file calls the php command which I replaced with php-win because the first one was creating an additional cmd window, while the second one doesn't create any output.

To solve the output issue, I have finished that php-win line with > some_temp_file.txt to catch the "output".
At the end of the batch file I just did type some_temp_file.txt

@tom-radboudumc
Copy link

@andrija-naglic what does your batchfile look like exactly? I ran into the same problem but I don't quite follow your explanation 😟

@andrija-naglic
Copy link

andrija-naglic commented Feb 13, 2024

Sure thing @tom-radboudumc , there you go, my linter.xml:

<NotepadPlus>
  <style color="00FFFF" alpha="100" />
  <linter extension=".php" command="C:\Users\Andrija\AppData\Roaming\Composer\vendor\bin\phpcsw.bat"/>
</NotepadPlus>

And here's the .bat file:

@echo off

setlocal DISABLEDELAYEDEXPANSION
SET BIN_TARGET=C:\Users\Andrija\AppData\Roaming\Composer\vendor\bin/phpcs
SET COMPOSER_RUNTIME_BIN_DIR=C:\Users\Andrija\AppData\Roaming\Composer\vendor\bin

set F=%1
set F=%F:.temp.linter.file.tmp=%
php-win "C:\Users\Andrija\AppData\Roaming\Composer\vendor\bin/phpcs" --report=checkstyle --standard=WordPress "%F%" > D:\temp\linter.tmp

type D:\temp\linter.tmp

The first SET commands are from the original phpcs.bat file - I had problems one batch file calling another one, so I created the phpcsw file.

The second set commands are from some github issue or somewhere.

At the end you output the content of the temp file.

Bear in mind - you have to edit the proper paths for your machine .)

@tom-radboudumc
Copy link

It works! Thank you so much!

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

No branches or pull requests

3 participants