clj-on-windows

For those interested in making clj on Windows https://dev.clojure.org/jira/browse/TDEPS-67. Also see https://github.com/littleli/scoop-clojure.
borkdude 2020-06-23T07:55:01.136Z

I'm trying to install cygwin to try if "start" works there, because I want to write some version of clojure.java.browse/browse-url for babashka

borkdude 2020-06-23T07:55:30.136600Z

but I can't get Cygwin to work in my Windows 10.... does someone have this installed and can they verify if "start index.html" works?

2020-06-23T12:06:50.137100Z

how did you try installing cygwin?

2020-06-23T12:08:25.137600Z

i tried with scoop and it seems to be doing something.

2020-06-23T12:11:24.138Z

...and what is "start"?

borkdude 2020-06-23T12:28:46.138300Z

start is the equivalent of open and xdg-open

borkdude 2020-06-23T12:29:08.138700Z

it works with cmd.exe /C start <some-url> but I wonder if that also works within cygwin

borkdude 2020-06-23T12:30:09.139Z

I tried installing cygwin using the installer from their website

borkdude 2020-06-23T12:30:18.139300Z

but maybe it conflicted with git bash terminal

2020-06-23T12:35:16.139600Z

fwiw, scoop installation seemed to work

2020-06-23T12:37:05.140Z

so i have a cygwin terminal open -- what should i type?

2020-06-23T12:37:14.140300Z

the thing starting with cmd.exe?

2020-06-23T12:40:49.140800Z

this seemed to work at the cygwin terminal:

cygstart <https://clojure.org>

2020-06-23T12:41:33.141100Z

this worked too:

cmd /c start <https://clojure.org>

borkdude 2020-06-23T12:42:43.141700Z

cool, that's what I wanted to know

2020-06-23T12:42:49.141900Z

great 🙂

borkdude 2020-06-23T12:43:39.142200Z

let me push a new babashka to appveyor, would you test it out?

borkdude 2020-06-23T12:43:41.142400Z

in cygwin

2020-06-23T12:43:45.142600Z

sure

borkdude 2020-06-23T12:44:05.143Z

pushed it in the java-browse branch, I'll link the binary in a minute

borkdude 2020-06-23T12:57:34.143800Z

@sogaiu https://ci.appveyor.com/project/borkdude/babashka/builds/33687853/artifacts test case:

bb "(clojure.java.browse/browse-url \"<https://babashka.org>\")"
should work in both cmd.exe, powershell and cygwin

2020-06-23T13:01:43.145400Z

@borkdude results: cmd.exe opened a browser appropriately with output:

{:exit 0, :out "", :err ""}
cygwin failed with output:
clojure.lang.ExceptionInfo: Could not resolve symbol: clojure.java.browse/browse-url [at line 1, column 2]
powershell failed with output:
clojure.lang.ExceptionInfo: [line 1, col 57] Unsupported escape character: \).

borkdude 2020-06-23T13:02:18.145600Z

could be just a quoting issue

borkdude 2020-06-23T13:02:35.146Z

can you try in cygwin:

bb '(clojure.java.browse/browse-url "<https://babashka.org>")'

2020-06-23T13:02:55.146400Z

ah in cygwin, i may have executed the wrong bb -- let me make sure

borkdude 2020-06-23T13:03:25.146900Z

bb --version should say 0.1.3-SNAPSHOT

2020-06-23T13:03:26.147Z

ok, that was it. cygwin worked fine. sorry about that.

borkdude 2020-06-23T13:04:23.147400Z

maybe in powershell try the bb repl, to avoid quoting issues

borkdude 2020-06-23T13:04:47.147700Z

can also try that myself, it's only cygwin I didn't have

2020-06-23T13:05:18.148Z

works via bb repl

borkdude 2020-06-23T13:05:28.148300Z

cool, so everything works as expected now then

2020-06-23T13:05:35.148500Z

\o/

borkdude 2020-06-23T13:06:25.148700Z

thanks!

2020-06-23T13:06:28.148900Z

np

borkdude 2020-06-23T13:06:40.149100Z

This is the code btw:

(def os
  (let [os-name (System/getProperty "os.name")
        os-name (str/lower-case os-name)]
    (cond (str/starts-with? os-name "mac os x")
          :mac
          (str/includes? os-name "linux")
          :linux
          (str/includes? os-name "win")
          :windows)))

(defn browse-url [url]
  (let [url (str url)]
    (case os
      :mac (sh "/usr/bin/open" url)
      :linux (sh "/usr/bin/xdg-open" url)
      :windows (sh "cmd" "/C" "start" url))))

2020-06-23T13:07:51.149500Z

curious why you went for "mac os x" -- would "mac" be somehow safer perhaps?

borkdude 2020-06-23T13:11:05.149800Z

I copied that from the original clojure.java.browse namespace

borkdude 2020-06-23T13:11:34.150200Z

so if it starts failing over there, core.clojure has a problem

borkdude 2020-06-23T13:12:17.150800Z

so I'll probably start hearing about that soon enough 😉

2020-06-23T13:19:00.151Z

ha ha ha -- good point

borkdude 2020-06-23T13:21:45.151600Z

btw I noticed that my Debian VPS installation (running since 2012 or so) didn't have xdg-open, is that a new thing?

borkdude 2020-06-23T13:22:09.151900Z

or is it only available on desktop linuxes

littleli 2020-06-23T14:05:23.152800Z

@borkdude https://en.wikipedia.org/wiki/Portland_Project btw name given by Nat Friedman, now CEO of Github