Description:
rexxref, ADDRESS, WITH INPUT:
If option USING is specified, expr must be [...] an expression enclosed in parentheses that evaluates to a String, a Stem object, an InputStream, a Monitor or a File object, [...]. If the resulting object is a String, the command will receive a single input line, if it is a Stem, an InputStream, a Monitor, or a File object, input is redirected as described for options STEM and STREAM.
So a File object should feed the lines of the file to the command, as INPUT STREAM does. It doesn't: the command receives no input at all.
f = "/tmp/inusing.txt"
call lineout f, "alpha"
call lineout f, "beta"
call stream f, "c", "close"
out.0 = 0
address system "cat" with input using (.File~new(f)) output stem out.
say "INPUT USING .File : rc="rc", lines="out.0 -- expected 2
out.0 = 0
address system "cat" with input stream (f) output stem out.
say "INPUT STREAM : rc="rc", lines="out.0 -- 2
Actual:
rc=0, lines=0. cat gets an empty input.rc=0, lines=2 (alpha, beta), as with INPUT STREAM.Notes:
.Object~new, gives 98.924, "is not a valid ADDRESS WITH INPUT source"), but it is read as if it were empty.address-input-using-file.rex, is attached.
Anonymous
fixed code and added test with revision [r13266]
Related
Commit: [r13266]