47
47
(: A file descriptor set to bash:pipe-in can be read, and the input is taken from the third parameter
48
48
(each xs:string item is used for an input pipe, in the same order) :)
49
49
(: A file descriptor set to bash:pipe-out can be written to, and the output produced is returned by the function (one item for each output pipe, in the file descriptor order) :)
50
declare %an:sequential function bash:exec($args as xs:string*, $mapping as xs:anyURI*, $input-pipes as xs:string*) as xs:string* external;
50
declare %an:sequential function bash:exec($args as xs:string*, $pipe-ins as xs:int*,
51
$input-streams as xs:string*, $pipe-outs as xs:int*) as xs:string* external;
53
declare %an:sequential function bash:exec($args as xs:string*, $pipe-ins as xs:int*,
54
$input-streams as xs:string*) as xs:string* {
55
bash:exec($args, $pipe-ins, $input-streams, ())
52
58
(: Executes exec with the supplied parameters, with the supplied file descriptor mapping, piping in being disallowed :)
53
declare %an:sequential function bash:exec($args as xs:string*, $mapping as xs:anyURI*) as xs:string* {
54
bash:exec($args, $mapping, ())
59
declare %an:sequential function bash:exec($args as xs:string*, $pipe-outs as xs:int*) as xs:string* {
60
bash:exec($args, (), (), $pipe-outs)
57
63
(: Executes exec with the supplied parameters, with the default file descriptor mapping :)
58
64
declare %an:sequential function bash:exec($args as xs:string*) as empty-sequence() {
59
bash:exec($args, $bash:default-fd-mapping, ())
62
declare function bash:redirect($mapping as xs:anyURI*, $index as xs:integer*, $target as xs:anyURI*) as xs:anyURI* {
64
if (fn:count($index) = 0 or fn:count($target) = 0) then
67
fn:insert-before(fn:subsequence($mapping, $index[1] + 1 + 1), 1, fn:insert-before($target[1], 1, fn:subsequence($mapping, 1, $index[1] + 1 - 1)))
70
if (fn:count($index) = 0 or fn:count($target) = 0) then
73
bash:redirect($new_map, fn:subsequence($index, 2), fn:subsequence($target, 2))
65
bash:exec($args, (), (), ())
76
68
(: Get the current directory path :)