degree9 / boot-exec Goto Github PK
View Code? Open in Web Editor NEWBoot-clj external process execution using Apache Commons Exec
License: MIT License
Boot-clj external process execution using Apache Commons Exec
License: MIT License
Include option adds everything to the fileset, that’s not probably what most people want
Hello @flyboarder!
While working on the less compiler, I have noticed that when I use :show true
sometimes I get:
Executing Process: /home/arichiardi/git/ar-website/node_modules/less/bin/lessc
java.lang.Thread.run Thread.java: 748
java.util.concurrent.ThreadPoolExecutor$Worker.run ThreadPoolExecutor.java: 624
java.util.concurrent.ThreadPoolExecutor.runWorker ThreadPoolExecutor.java: 1149
java.util.concurrent.FutureTask.run FutureTask.java: 266
...
clojure.core/binding-conveyor-fn/fn core.clj: 1938
boot.core/boot/fn core.clj: 1031
boot.core/run-tasks core.clj: 1021
boot.task.built-in/fn/fn/fn/fn built_in.clj: 632
degree9.boot-exec/eval3376/fn/fn/fn boot_exec.clj: 30
degree9.boot-exec/eval3419/fn/fn/fn boot_exec.clj: 78
boot.task.built-in/fn/fn/fn/fn built_in.clj: 632 (repeats 2 times)
boot.user$eval5027$fn__5028$fn__5033$fn__5034.invoke : 110
degree9.boot-exec/eval3419/fn/fn/fn boot_exec.clj: 79
degree9.boot-exec/exec-impl boot_exec.clj: 63
...
boot.util/info util.clj: 142
boot.util/print* util.clj: 75
clojure.core/apply core.clj: 646
...
clojure.core/format core.clj: 5527
clojure.core/format core.clj: 5533
java.lang.String.format String.java: 2940
java.util.Formatter.format Formatter.java: 2455
java.util.Formatter.format Formatter.java: 2501
java.util.Formatter.parse Formatter.java: 2547
java.util.regex.Pattern.matcher Pattern.java: 1093
java.util.regex.Matcher.<init> Matcher.java: 229
java.util.regex.Matcher.reset Matcher.java: 309
java.util.regex.Matcher.getTextLength Matcher.java: 1283
The files gets generated but it seems that this line needs to be skipped if stdout
is nil
.
Leaving this open for now, I might have time later for a simple fix.
The exec
task always calls add-resource
on the target directory. This is no doubt useful for many cases (generating some assets in a process etc), but problematic when using exec
in a build pipeline, because unintended files get added to the fileset.
I encountered this via degree9/boot-semgit
, because executing a git task was adding the entire repo to the fileset (including .git
directory) which would then be packaged in by boot's jar
task. I figured I'd report it here because it can't be fixed in semgit without changes in exec.
My suggestion for fixing this would be to make the "add dir as resource" behavior toggle-able via a parameter, which boot-semgit
could then use to disable it.
Minimal repro case in a directory containing a build.boot
with only a boot-exec dependency + require in it:
$ boot exec -p ls -d . show -f
Executing Process: ls
Process completed successfully...
└── build.boot
The build file is added to the fileset even though it is not in a source/resource/asset directory.
I want to run compiled js file with node but it fail with error.
boot-exec run command in own tmp dir, not current fileset.
How I can do following?
(deftask dev []
(comp
(wait)
(cljs :compiler-options {:target :nodejs})
(exec :process "node" :arguments ["main.js"])))
For whatever reason the process I try to invoke returns an error message that contains %2f
and subsequently I receive this error from boot-exec:
Executing Process: /usr/local/bin/npm
Executing Process with arguments: ["install" "--production"]
clojure.lang.ExceptionInfo: Format specifier '%2f' {:line 243}
at clojure.core$ex_info.invokeStatic(core.clj:4617)
at clojure.core$ex_info.invoke(core.clj:4617)
at boot.main$_main$fn__1201.invoke(main.clj:222)
at boot.main$_main.invoke(main.clj:216)
at clojure.lang.Var.invoke(Var.java:394)
at org.projectodd.shimdandy.impl.ClojureRuntimeShimImpl.invoke(ClojureRuntimeShimImpl.java:159)
at org.projectodd.shimdandy.impl.ClojureRuntimeShimImpl.invoke(ClojureRuntimeShimImpl.java:150)
at boot.App.runBoot(App.java:399)
at boot.App.main(App.java:491)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at Boot.main(Boot.java:257)
Caused by: java.util.MissingFormatArgumentException: Format specifier '%2f'
at java.util.Formatter.format(Formatter.java:2519)
at java.util.Formatter.format(Formatter.java:2455)
at java.lang.String.format(String.java:2940)
at clojure.core$format.invokeStatic(core.clj:5533)
at clojure.core$format.doInvoke(core.clj:5527)
at clojure.lang.RestFn.invoke(RestFn.java:410)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invokeStatic(core.clj:646)
at clojure.core$apply.invoke(core.clj:641)
at boot.util$print_STAR_.invoke(util.clj:75)
at boot.util$info.doInvoke(util.clj:142)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at degree9.boot_exec$exec_impl.invokeStatic(boot_exec.clj:62)
at degree9.boot_exec$exec_impl.invoke(boot_exec.clj:49)
at degree9.boot_exec$eval1365$fn__1366$fn__1371$fn__1372.invoke(boot_exec.clj:79)
at degree9.boot_exec$eval1322$fn__1323$fn__1328$fn__1329.invoke(boot_exec.clj:30)
at boot.core$run_tasks.invoke(core.clj:1021)
at boot.core$boot$fn__933.invoke(core.clj:1031)
at clojure.core$binding_conveyor_fn$fn__4676.invoke(core.clj:1938)
at clojure.lang.AFn.call(AFn.java:18)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Small feature request:: it would be awesome if I could pass a map to exec
that sets the environment variables before launching the process.
This package should provide both a restart
task and a serve
task.
Restart should be able to terminate a running executable and relaunch it each time the fileset changes. (generalize boot-nodejs serve task)
Serve should be able to start an executable and return output until boot is terminated. (ie. boot-nodejs serve task without restart)
$ boot exec -p npm -a "ls"
clojure.lang.ExceptionInfo: java.lang.NullPointerException
data: {:file
"/var/folders/1z/ppk2mhqs07q29pbhf_xc8bdm0000gn/T/boot.user5530946695506384365.clj",
:line 29}
java.util.concurrent.ExecutionException: java.lang.NullPointerException
java.lang.NullPointerException:
clojure.java.io/as-relative-path/invokeStatic io.clj: 414
clojure.java.io/file/invokeStatic io.clj: 426
clojure.java.io/file/invokeStatic io.clj: 418
clojure.java.io/file io.clj: 418
...
degree9.boot-exec/eval3600/fn boot_exec.clj: 44
...
clojure.core/apply/invokeStatic core.clj: 657
clojure.core/apply core.clj: 652
boot.core/construct-tasks core.clj: 760
...
clojure.core/apply/invokeStatic core.clj: 657
clojure.core/apply core.clj: 652
boot.core/boot/fn core.clj: 805
clojure.core/binding-conveyor-fn/fn core.clj: 2019
...
$ boot exec -p npm -a "ls" -l ""
Executing Process: /usr/local/bin/npm
Process completed successfully...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.