dploeger / idea.shellfilter

The IDEA Shell Filter plugin
https://plugins.jetbrains.com/plugin/9958-shell-filter
Other
5 stars 0 forks source link

No command file created on windows 10 #7

Open Vikdemen opened 2 years ago

Vikdemen commented 2 years ago

I've tested your plugin on Windows 10, in Pycharm and it fails to create a temporary command file. It tries to create a file C:\Users\username\AppData\Local\Temp\shellfiltercommand, which should be correct name and location, but I can't find that file in the directory. Then it tries to add that invalid path to specified program. "pwsh.exe -c echo" will print out the path to the IDE without errors, but most other programs will report an error about missing file. I can create a new temporary file manually, so the permissions should be okay, and your code seems to use File.createTempFile() method, which is not Unix-specific and will write the file to a default temporary file location. Unfortunately, I don't know how to access debug logs for your plugin. How can I pinpoint the the cause of that issue and is it possible to fix that without changing the plugin's source code?

dploeger commented 2 years ago

The temporary file is deleted directly after running the command. That's why you can't see it maybe.

Can you post the command and the missing file error you get?

In IntelliJ I have the menu "Debug Log Settings" in the "Diagnostic Tools" submenu of the help menu:

image

I don't know, where this menu item is located on Windows and Pycharm, but maybe you can find it.

You should be able to add

de.dieploegers.develop.idea.shellfilter.FilterAction:DEBUG

to this setting to turn on the debug log, if I'm not mistaken.

Vikdemen commented 2 years ago

Thanks! However, when I tried to replicate the error, I discovered that plugin stopped working entirely, which didn't happen yesterday. I'm not sure what could be the cause here. The command is powershell.exe -c write-output %s + 'test' This should send the filename of temporary file in stdout and it worked before. However, now it errors out instead. When I try to invoke cmd, it hangs instead.

Relevant portion of the logs. https://www.toptal.com/developers/hastebin/yeviqejufe.http Despite adding the entry in debug log settings, I couldn't find debug messages in idea.log file.

image Error box.

dploeger commented 2 years ago

I'm sorry, but what does the text after the colon translate to in English? Apparently the error message uses your system locale and I don't speak the language.

Vikdemen commented 2 years ago

"Channel/Pipe was closed".

dploeger commented 2 years ago

Hm. This sounds as if the command was run, but didn't return anything or ended prematurely...

Can you kindly post a screenshot of your configuration for Shell Filter?

seregaizsbera commented 1 year ago

Hi, I caught the same issue and noticed some new aspects.

If you select a piece of text in editor, command runs successfully. The error occurs only when nothing is selected.

Details

2023-07-11 22:53:57,034 [  37511] SEVERE - #d.d.d.i.s.FilterAction - Can not execute command: Идет закрытие канала
java.io.IOException: Идет закрытие канала
    at java.base/java.io.FileOutputStream.writeBytes(Native Method)
    at java.base/java.io.FileOutputStream.write(FileOutputStream.java:349)
    at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81)
    at java.base/java.io.BufferedOutputStream.flush(BufferedOutputStream.java:142)
    at java.base/java.io.FilterOutputStream.close(FilterOutputStream.java:182)
    at java.base/java.io.FilterOutputStream.close(FilterOutputStream.java:191)
    at de.dieploegers.develop.idea.shellfilter.FilterAction.process(FilterAction.java:347)
    at de.dieploegers.develop.idea.shellfilter.FilterAction.runCommand(FilterAction.java:198)
    at de.dieploegers.develop.idea.shellfilter.FilterAction.lambda$actionPerformed$0(FilterAction.java:146)
    at com.intellij.ui.popup.PopupListAdapter.lambda$setItemChosenCallback$0(PopupListAdapter.java:56)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)
    at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:94)
    at com.intellij.ui.popup.AbstractPopup.lambda$dispose$18(AbstractPopup.java:1543)
    at com.intellij.util.ui.EdtInvocationManager.invokeLaterIfNeeded(EdtInvocationManager.java:113)
    at com.intellij.ide.IdeEventQueue.ifFocusEventsInTheQueue(IdeEventQueue.java:180)
    at com.intellij.ide.IdeEventQueue.executeWhenAllFocusEventsLeftTheQueue(IdeEventQueue.java:133)
    at com.intellij.openapi.wm.impl.FocusManagerImpl.doWhenFocusSettlesDown(FocusManagerImpl.java:164)
    at com.intellij.ui.popup.AbstractPopup.dispose(AbstractPopup.java:1540)
    at com.intellij.openapi.util.ObjectTree.runWithTrace(ObjectTree.java:126)
    at com.intellij.openapi.util.ObjectTree.executeAll(ObjectTree.java:158)
    at com.intellij.openapi.util.Disposer.dispose(Disposer.java:217)
    at com.intellij.ui.popup.AbstractPopup.cancel(AbstractPopup.java:800)
    at com.intellij.ui.popup.AbstractPopup.closeOk(AbstractPopup.java:734)
    at com.intellij.openapi.ui.popup.PopupChooserBuilder.closePopup(PopupChooserBuilder.java:470)
    at com.intellij.openapi.ui.popup.PopupChooserBuilder$1.mouseReleased(PopupChooserBuilder.java:329)
    at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:298)
    at java.desktop/java.awt.Component.processMouseEvent(Component.java:6648)
    at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3392)
    at java.desktop/java.awt.Component.processEvent(Component.java:6413)
    at java.desktop/java.awt.Container.processEvent(Container.java:2266)
    at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5022)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854)
    at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
    at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575)
    at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
    at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
    at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2802)
    at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:781)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:730)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:724)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:754)
    at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:752)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
    at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:751)
    at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:918)
    at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:840)
    at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:763)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:450)
    at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:791)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:449)
    at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:113)
    at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:624)
    at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$8(IdeEventQueue.java:447)
    at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:881)
    at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:493)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
    at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)
    Suppressed: java.io.IOException: Канал был закрыт
        at java.base/java.io.FileOutputStream.writeBytes(Native Method)
        at java.base/java.io.FileOutputStream.write(FileOutputStream.java:349)
        at java.base/java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:81)
        at java.base/java.io.BufferedOutputStream.flush(BufferedOutputStream.java:142)
        at java.base/java.io.DataOutputStream.flush(DataOutputStream.java:128)
        at java.base/java.io.FilterOutputStream.close(FilterOutputStream.java:182)
        ... 61 more
2023-07-11 22:53:57,034 [  37511] SEVERE - #d.d.d.i.s.FilterAction - IntelliJ IDEA 2022.2.1  Build #IU-222.3739.54
2023-07-11 22:53:57,034 [  37511] SEVERE - #d.d.d.i.s.FilterAction - JDK: 17.0.3; VM: OpenJDK 64-Bit Server VM; Vendor: JetBrains s.r.o.
2023-07-11 22:53:57,034 [  37511] SEVERE - #d.d.d.i.s.FilterAction - OS: Windows 10
2023-07-11 22:53:57,034 [  37511] SEVERE - #d.d.d.i.s.FilterAction - Plugin to blame: Shell Filter version: 4.3.0

dploeger commented 1 year ago

@seregaizsbera What command did you configure?

seregaizsbera commented 1 year ago

@dploeger

@seregaizsbera What command did you configure?

echo 123

dploeger commented 1 year ago

Hm... Can't reproduce it. What shell did you configure in the settings? I've got /bin/bash %s. If you got the same, is /bin/bash executable on your system?

seregaizsbera commented 1 year ago

It occurs on windows 10

dploeger commented 1 year ago

Ohhh, okay. You'll have to set the path to cmd.exe (or if you have bash, bash.exe) in the settings. The default is for Linux and macOS.

seregaizsbera commented 1 year ago

There is no problem to find a shell. It simply doesn't work on windows, when nothing is selected in editor.

dploeger commented 1 year ago

Ah okay. Sorry about that. I don't have a Windows machine to test and fix that sadly.