Fixed
Details
Assignee
UnassignedUnassignedReporter
Alex MillerAlex MillerLabels
Approval
OkPatch
Code and TestPriority
CriticalAffects versions
Fix versions
Details
Details
Assignee
Unassigned
UnassignedReporter
Alex Miller
Alex MillerLabels
Approval
Ok
Patch
Code and Test
Priority
Affects versions
Fix versions
Created June 28, 2024 at 1:47 PM
Updated July 29, 2024 at 7:03 PM
Resolved July 29, 2024 at 7:03 PM
Per
clojure.java.process/start
returns a reify ofILookup
,IDeref
, andIBlockingDeref
.The
IBlockingDeref
implementation is wrong - it just passes the two timeout args from blocking(deref [ref timeout-ms timeout-val])
to Process.waitFor(long timeout, TimeUnit unit). Those don’t match. Also, the return value of the 2-arity Process.waitFor() is a boolean, instead of the exit value returned from the 0-arity, so that is also broken.Additionally:
Both impls of deref return boxed Integer, should return Long.
start
should not return an object that is both a value (streams map) and a reference (for waiting). Simply return the Process, and provide a helperexit-ref
that can wait for the process and return the exit code on completion.Approach: Correctly implement the blocking deref arity to always use TimeUnit/MILLISECONDS as the timeout unit, return the timeout value on timeout, and return the exit value on non-timeout.
Change
start
return, addexit-ref
, removeok?
(as it is then just azero?
check onexit-ref
). Addstdout
stderr
andstdin
helpers to pull the correct stream from the Process.Patch: clj-2865-6.patch
Screened by: fogus