If we pass a file handler to a UserdefinedFunction the file handler will be closed once the call is done, even though it still needed for the rest of the code.
how to reproduce
- Create a test file
echo "hello" > /tmp/file
- Run this script
xquery version "3.1";
declare namespace file = "http://exist-db.org/xquery/file";
declare function local:noop($b) { 1 };
let $b := file:read-binary("/tmp/file")
let $tmp := local:noop($b)
(: no longer accessible:)
return string($b)
results
We get Underlying channel has been closed
expected
We should get the string value of the file.
This issue is similar to eXist-db/exist#6725 but we are sure it's not coming from the same origin.
If we pass a file handler to a UserdefinedFunction the file handler will be closed once the call is done, even though it still needed for the rest of the code.
how to reproduce
echo "hello" > /tmp/fileresults
We get
Underlying channel has been closedexpected
We should get the string value of the file.
This issue is similar to eXist-db/exist#6725 but we are sure it's not coming from the same origin.