Skip to content

Commit

Permalink
Fix "Argument list too long" error
Browse files Browse the repository at this point in the history
There is a limit on the size of the command line arguments. Write the lock
file to a temp file to avoid hitting the limit.
  • Loading branch information
jlesquembre committed Aug 19, 2023
1 parent 488cfc7 commit a2bbd3a
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/cljnix/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -475,14 +475,17 @@
slurp
edn/read-string)}
opts))
lock-str (json/write-str
lock-data
:escape-slash false
:escape-unicode false
:escape-js-separators false)]
(->> (sh/sh "jq" "-n" "--argjson" "data" lock-str "$data")
tmp-json (fs/create-temp-file {:suffix ".json"})]
(with-open [writer (-> tmp-json fs/file io/writer)]
(json/write lock-data
writer
:escape-slash false
:escape-unicode false
:escape-js-separators false))
(->> (sh/sh "jq" "." (str tmp-json))
:out
(spit lock-file-name))
(fs/delete tmp-json)
(when-not (git-tracked-file? lock-file-name)
(git-add lock-file-name)))
(shutdown-agents))
Expand Down

0 comments on commit a2bbd3a

Please sign in to comment.