Skip to content

Commit

Permalink
escape parens
Browse files Browse the repository at this point in the history
  • Loading branch information
bakpakin committed Sep 27, 2024
1 parent b5048d9 commit b2d3783
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion spork/cc.janet
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,13 @@
(os/getenv "LIB")
(os/getenv "LIBPATH")))

(defn- dumb-escape
[x]
(->> x
(string/replace-all " " "^ ")
(string/replace-all "(" "^(")
(string/replace-all ")" "^)")))

(defn msvc-find
"Find vcvarsall.bat and run it to setup the current environment for building.
Optionally pass in `year` and `edition` to help look for vcvars.
Expand All @@ -343,7 +350,7 @@
(unless found-path (error "Could not find vcvarsall.bat"))
(when (dyn :verbose)
(print "found " found-path))
(def arg (string (string/replace-all " " "^ " found-path) ` ` arch ` && echo ` tag ` && set`))
(def arg (string (dumb-escape found-path) ` ` arch ` && echo ` tag ` && set`))
(def output (sh/exec-slurp "cmd" "/s" "/c" arg))
(def kvpairs (peg/match vcvars-grammar output))
(assert kvpairs)
Expand Down

0 comments on commit b2d3783

Please sign in to comment.