clj-on-windows 2020-06-23

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

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?

how did you try installing cygwin?

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

...and what is "start"?

start is the equivalent of open and xdg-open

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

I tried installing cygwin using the installer from their website

but maybe it conflicted with git bash terminal

fwiw, scoop installation seemed to work

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

the thing starting with cmd.exe?

this seemed to work at the cygwin terminal:

cygstart 

this worked too:

cmd /c start 

cool, that's what I wanted to know

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

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

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

bb "(clojure.java.browse/browse-url \"\")"
should work in both cmd.exe, powershell and cygwin

@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: \).

could be just a quoting issue

can you try in cygwin:

bb '(clojure.java.browse/browse-url "")'

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

bb --version should say 0.1.3-SNAPSHOT

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

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

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

works via bb repl

cool, so everything works as expected now then

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))))

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

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

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

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

ha ha ha -- good point

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

or is it only available on desktop linuxes

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