-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Labels
bugSomething isn't workingSomething isn't working
Description
After fix this #85
The 1.5.0 version still can't execute lein.bat
on windows.
It still gives me the error.
Cannot run program "lein" (in directory "C:\Users\david\source\stock"): CreateProcess error=2
The system is Windows 11 Home
The environment is
IntelliJ IDEA 2024.1.6 (Ultimate Edition)
Build #IU-241.19072.14, built on August 8, 2024
Licensed to Tianpo Gao
You have a perpetual fallback license for this version.
Subscription is active until June 13, 2025.
Runtime version: 17.0.11+1-b1207.30 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 11.0
GC: G1 Young Generation, G1 Old Generation
Memory: 4096M
Cores: 8
Registry:
ide.experimental.ui=true
Non-Bundled Plugins:
com.github.clojure-repl (1.5.0)
com.github.clojure-lsp (2.6.1)
Kotlin: 241.19072.14-IJ
and the new function locate-executable
can locate the lein file correctly with the result "C:\Users\david\bin\lein.bat"
(defn ^:private locate-executable
"Locate and return the full path to the EXECUTABLE."
[executable]
(some-> ^java.nio.file.Path (fs/which executable) .toString))
stack with extra info
2024-08-30 22:57:06,254 [ 558426] INFO - #com.github.ericdallo.clj4intellij.ClojureClassLoader - [Clojure REPL] ----------__> {}
2024-08-30 22:57:06,255 [ 558427] FINER - #c.i.o.a.i.NonBlockingReadActionImpl - Cleaning Submission{com.intellij.execution.impl.statistics.RunConfigurationUsageTriggerCollector$$Lambda$3422/0x0000000802cdbc38@1cab45ef, SUCCEEDED}
2024-08-30 22:57:06,255 [ 558427] FINE - #c.i.e.c.GeneralCommandLine - Executing [lein update-in :dependencies conj "[nrepl/nrepl \"1.0.0\"]" -- update-in :plugins conj "[cider/cider-nrepl \"0.45.0\"]" -- with-profile +dev repl :headless :host localhost]
2024-08-30 22:57:06,255 [ 558427] FINE - #c.i.e.c.GeneralCommandLine - working dir: C:\Users\david\source\stock
2024-08-30 22:57:06,255 [ 558427] FINE - #c.i.e.c.GeneralCommandLine - environment: {} (+CONSOLE)
2024-08-30 22:57:06,255 [ 558427] FINE - #c.i.e.c.GeneralCommandLine - charset: UTF-8
2024-08-30 22:57:06,255 [ 558427] FINE - #c.i.e.c.GeneralCommandLine - Building process with commands: [lein, update-in, :dependencies, conj, "[nrepl/nrepl \"1.0.0\"]", --, update-in, :plugins, conj, "[cider/cider-nrepl \"0.45.0\"]", --, with-profile, +dev, repl, :headless, :host, localhost]
2024-08-30 22:57:06,261 [ 558433] FINE - #c.i.c.s.BuildManager - Automake scheduled:
at java.base/java.lang.Thread.getStackTrace(Thread.java:1619)
at com.intellij.compiler.server.BuildManager.getThreadTrace(BuildManager.java:669)
at com.intellij.compiler.server.BuildManager.scheduleAutoMake(BuildManager.java:661)
at com.intellij.compiler.server.BuildManager$BuildManagerStartupActivity$1.processNotStarted(BuildManager.java:2024)
at com.intellij.execution.ExecutionListener.processNotStarted(ExecutionListener.java:18)
at com.intellij.util.messages.impl.MessageBusImplKt.invokeMethod(MessageBusImpl.kt:700)
at com.intellij.util.messages.impl.MessageBusImplKt.invokeListener(MessageBusImpl.kt:660)
at com.intellij.util.messages.impl.MessageBusImplKt.deliverMessage(MessageBusImpl.kt:423)
at com.intellij.util.messages.impl.MessageBusImplKt.pumpWaiting(MessageBusImpl.kt:402)
at com.intellij.util.messages.impl.MessageBusImplKt.access$pumpWaiting(MessageBusImpl.kt:1)
2024-08-30 22:57:06,261 [ 558433] FINE - #c.i.e.r.ExecutionUtil - Cannot run program "lein" (in directory "C:\Users\david\source\stock"): CreateProcess error=2, 系统找不到指定的文件。
com.intellij.execution.process.ProcessNotCreatedException: Cannot run program "lein" (in directory "C:\Users\david\source\stock"): CreateProcess error=2, 系统找不到指定的文件。
at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:367)
at com.intellij.execution.process.OSProcessHandler.startProcess(OSProcessHandler.java:86)
at com.intellij.execution.process.OSProcessHandler.<init>(OSProcessHandler.java:46)
at com.intellij.execution.process.KillableProcessHandler.<init>(KillableProcessHandler.java:41)
at com.intellij.execution.process.ColoredProcessHandler.<init>(ColoredProcessHandler.java:23)
at com.github.clojure_repl.intellij.configuration.factory.local.proxy$com.intellij.execution.process.ColoredProcessHandler$ff19274a.<init>(Unknown Source)
at com.github.clojure_repl.intellij.configuration.factory.local$setup_process.invokeStatic(local.clj:53)
at com.github.clojure_repl.intellij.configuration.factory.local$setup_process.invoke(local.clj:47)
at com.github.clojure_repl.intellij.configuration.factory.local$configuration_factory$fn__14201$fn__14204$fn__14209.invoke(local.clj:101)
at com.github.clojure_repl.intellij.configuration.factory.local.proxy$com.intellij.execution.configurations.CommandLineState$ff19274a.startProcess(Unknown Source)
at com.intellij.execution.configurations.CommandLineState.execute(CommandLineState.java:61)
at com.github.clojure_repl.intellij.configuration.factory.local.proxy$com.intellij.execution.configurations.CommandLineState$ff19274a.execute(Unknown Source)
at com.intellij.execution.runners.DefaultRunProgramRunner$execute$1.invoke(DefaultRunProgramRunner.kt:29)
at com.intellij.execution.runners.DefaultRunProgramRunner$execute$1.invoke(DefaultRunProgramRunner.kt:18)
at com.intellij.execution.impl.ExecutionManagerImpl$startRunProfile$1.invoke(ExecutionManagerImpl.kt:220)
at com.intellij.execution.impl.ExecutionManagerImpl$startRunProfile$1.invoke(ExecutionManagerImpl.kt:218)
at com.intellij.execution.impl.ExecutionManagerImpl.doStartRunProfile$lambda$2(ExecutionManagerImpl.kt:283)
at com.intellij.util.concurrency.ContextRunnable.run(ContextRunnable.java:27)
at com.intellij.openapi.application.TransactionGuardImpl.runWithWritingAllowed(TransactionGuardImpl.java:209)
at com.intellij.openapi.application.TransactionGuardImpl.access$100(TransactionGuardImpl.java:22)
at com.intellij.openapi.application.TransactionGuardImpl$1.run(TransactionGuardImpl.java:191)
at com.intellij.openapi.application.impl.RwLockHolder.runIntendedWriteActionOnCurrentThread(RwLockHolder.kt:204)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:830)
at com.intellij.openapi.application.impl.ApplicationImpl$2.run(ApplicationImpl.java:419)
at com.intellij.openapi.application.impl.RwLockHolder.runWithEnabledImplicitRead(RwLockHolder.kt:138)
at com.intellij.openapi.application.impl.RwLockHolder.runWithImplicitRead(RwLockHolder.kt:129)
at com.intellij.openapi.application.impl.ApplicationImpl.runWithImplicitRead(ApplicationImpl.java:1152)
at com.intellij.openapi.application.impl.FlushQueue.doRun(FlushQueue.java:81)
at com.intellij.openapi.application.impl.FlushQueue.runNextEvent(FlushQueue.java:123)
at com.intellij.openapi.application.impl.FlushQueue.flushNow(FlushQueue.java:43)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:792)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:739)
at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:733)
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:761)
at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.kt:699)
at com.intellij.ide.IdeEventQueue._dispatchEvent$lambda$12(IdeEventQueue.kt:593)
at com.intellij.openapi.application.impl.RwLockHolder.runWithoutImplicitRead(RwLockHolder.kt:105)
at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.kt:593)
at com.intellij.ide.IdeEventQueue.access$_dispatchEvent(IdeEventQueue.kt:77)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:362)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1$1.compute(IdeEventQueue.kt:361)
at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:843)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:361)
at com.intellij.ide.IdeEventQueue$dispatchEvent$processEventRunnable$1$1.invoke(IdeEventQueue.kt:356)
at com.intellij.ide.IdeEventQueueKt.performActivity$lambda$1(IdeEventQueue.kt:1022)
at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:106)
at com.intellij.ide.IdeEventQueueKt.performActivity(IdeEventQueue.kt:1022)
at com.intellij.ide.IdeEventQueue.dispatchEvent$lambda$7(IdeEventQueue.kt:356)
at com.intellij.openapi.application.impl.RwLockHolder.runIntendedWriteActionOnCurrentThread(RwLockHolder.kt:209)
at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:830)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.kt:398)
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)
Caused by: java.io.IOException: Cannot run program "lein" (in directory "C:\Users\david\source\stock"): CreateProcess error=2, 系统找不到指定的文件。
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1143)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1073)
at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:491)
at com.intellij.execution.configurations.GeneralCommandLine.startProcess(GeneralCommandLine.java:464)
at com.intellij.execution.configurations.GeneralCommandLine.createProcess(GeneralCommandLine.java:357)
... 59 more
Caused by: java.io.IOException: CreateProcess error=2, 系统找不到指定的文件。
at java.base/java.lang.ProcessImpl.create(Native Method)
at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:499)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:158)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1110)
... 63 more
When I use the Run Anything
in the idea to exec lein repl
, I will get an error. But when I use the Run Anything
to exec lein.bat repl
, I get the repl. I think this is may be a bug inside the idea.
So I think we may need to modify this function. In the windows we need to check the result of locate-executable
, check it has a bat
extension or not. If it has a bat
extension, I think we need to change the cmd
from lein
to lein.bat
.
(defn ^:private normalize-command
"Return CLASSPATH-CMD, but with the EXEC expanded to its full path (if found).
If the EXEC cannot be found, is one of clojure or lein and the
program is running on MS-Windows, then, if possible, it tries to
replace it with a PowerShell cmd invocation sequence in the
following manner, while keeping ARGS the same.
There could be two PowerShell executable available in the system
path: powershell.exe (up to version 5.1, comes with windows) and/or
pwsh.exe (versions 6 and beyond, can be installed on demand).
If powershell.exe is available, it checks if the EXEC is installed
in it as a module, and creates an invocation sequence as such to
replace the EXEC. If not, it tries the same with pwsh.exe."
[[exec & args :as cmd]]
(if (and windows-os?
(#{"clojure" "lein"} exec)
(not (locate-executable exec)))
(if-let [up (some #(when-let [ps (locate-executable %)]
(when (= 0 (:exit (apply shell (psh-cmd ps "Get-Command" exec))))
(psh-cmd ps exec)))
["powershell" "pwsh"])]
(into up args)
cmd)
cmd))
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Projects
Status
Todo