-
Notifications
You must be signed in to change notification settings - Fork 20
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
[ Summary ] Fix a process fork issue on Windows #88
base: master
Are you sure you want to change the base?
Conversation
[ Root Cause ] 1. There has no `clojure` script on Windows, the Clojure CLI is a PowerShell Module in windows, which cannot be called as a script directly. 2. Therefore, I make a `.bat` or `.cmd` to execute a PowerShell command. 3. After adding this `.bat` file to PATH, `lein-tools-deps` still cannot work, because the process created by `(shell/sh "clojure" "-Sdescribe")` cannot find either `clojure.bat` or `clojure.cmd` in PATH. [Solution/Workaround ] `(shell/sh "cmd" "/c" "clojure" "-Sdescribe")` work well for both the 'clojure' script file in PATH and custom path from `clojure-executables`. [ Result ] I test these two snippets in REPL: (if (.startsWith (System/getProperty "os.name") "Windows") (shell/sh "cmd" "/c" "clojure" "-Sdescribe") (shell/sh "clojure" "-Sdescribe")) (if (.startsWith (System/getProperty "os.name") "Windows") (shell/sh "cmd" "/c" "path/to/clojure.cmd" "-Sdescribe") (shell/sh "/path/to/clojure.cmd" "-Sdescribe"))
Tested this PR, and this is what I get
|
Perhaps it's because currently, clojure isn't a binary on the path, but a powershell function
|
@hlolli isn't this what @zhanghuabin is saying you need to do here: i.e. that you need to wrap the powershell command with a If you can confirm this works, I'd be happy to merge this PR if it would also include instructions for how to make this work on windows. |
Note this issue also seems related: #85 If the windows users here can assemble a PR with all the changes required to work on windows with any required additional steps in the README, and can perhaps review it amongst yourselves then I'll consider merging. |
[ Root Cause ]
clojure
script on Windows, the Clojure CLI is a PowerShell Module in windows, which cannot be called as a script directly..bat
or.cmd
to execute a PowerShell command..bat
file to PATH,lein-tools-deps
still cannot work, because the process created by(shell/sh "clojure" "-Sdescribe")
cannot find eitherclojure.bat
orclojure.cmd
in PATH.[Solution/Workaround ]
(shell/sh "cmd" "/c" "clojure" "-Sdescribe")
work well for both the 'clojure' script file in PATH and custom path fromclojure-executables
.[ Result ]
I test these two snippets in REPL: