kando-menu / kando

🥧 The Cross-Platform Pie Menu.
https://ko-fi.com/post/Kando-1-0-0-released-G2G5Z1DOS
Other
1.19k stars 26 forks source link

JavaScript Error occurred in main process when executing commands on Windows #394

Closed multimokia closed 2 months ago

multimokia commented 2 months ago

When executing a command from Windows 10, be it either the direct filepath or a proper command, Kando will crash with the following error dialogue.

image

The config I have is a simple variation of the default template, though it replaces the first nested submenu with the following:

              {
                "name": "REAPER",
                "icon": "play_circle",
                "iconTheme": "material-symbols-rounded",
                "type": "command",
                "data": {
                    "command": "Start-Process -FilePath '\\Program Files\\REAPER (x64)\\reaper.exe'"
                }
              }

I have verified the command works in powershell, I have also tried this as simply just the path to the exe, both ways yield the issue.

I'm not sure what I'm doing wrong, but help would be greatly appreciated!

denis-roy commented 2 months ago

Hi @multimokia

Without knowing about your issue, I created my own shortly after you :)

I don't think you're doing anything wrong, I created a menu in its simplest form and still got the error. Let's fallback to v0.6 for now and wait to see if Simon can reproduce it ¯\ (ツ) /¯

Schneegans commented 2 months ago

Thank you both for reporting this issue so quickly! when I was able to track it down: This bug seems to occur when the command executes a non-zero exit code.

Due to the refactoring, I was now throwing the corresponding exception at a location where it could not be caught. I restructured now the action-execution related code to use proper asynchronous code. As a consequence, Kando should show a proper error notification again!

There is this weird issue (which we encountered before) that explorer.exe returns a non-zero exit code even if it runs successfully. Hence you get an error whenever you run explorer.exe. As a workaround, you can use powershell.exe start explorer.exe as suggested here.

I'll release a 0.7.1 version later today. If possible, you could test the fix beforehand by running the latest version from the main branch!

multimokia commented 2 months ago

Awesome, thanks for your work and quick update! I'll have to give this a shot when I get home from work if the fix hasn't been released yet.

denis-roy commented 2 months ago

I hereby confirm that the .zip build from current main fixes this, thanks @Schneegans! :)