When specifying both produce and product where the product is a directory, mach fails with the following exception:
Error: EISDIR: illegal operation on a directory, open '<YOUR_DIR>'
at Object.fs.openSync (fs.js:652:18)
at fs.writeFileSync (fs.js:1299:33)
at mach$core$spit_product (evalmachine.<anonymous>:1198:35)
at evalmachine.<anonymous>:1282:24
at evalmachine.<anonymous>:1312:43
at mach$core$state_machine__4__auto____1 (evalmachine.<anonymous>:1333:4)
at mach$core$state_machine__4__auto__ (evalmachine.<anonymous>:1349:46)
at cljs$core$async$impl$ioc_helpers$run_state_machine (evalmachine.<anonymous>:90:74)
at cljs$core$async$impl$ioc_helpers$run_state_machine_wrapped (evalmachine.<anonymous>:93:63)
at evalmachine.<anonymous>:112:67
Problem
When specifying both produce and product where the product is a directory, mach fails with the following exception:
This is due to https://github.com/juxt/mach/blob/master/src/mach/core.cljs#L265 calling fs.writeFileSync on the directory. I'm not really sure why this post-op is necessary.
Minimal Machfile.edn to reproduce
Work-around
You can use
update!
instead ofproduce
. I'm not sure if this is intended behavior. If that's the case, I think the docs should reflect this.