excmds.ts: Fix composite giving additional argument to first piped cmd

This commit is contained in:
glacambre 2018-05-28 19:48:35 +02:00
parent c4d1d9dcd2
commit 4f110f683d
No known key found for this signature in database
GPG key ID: B9625DB1767553AC

View file

@ -1664,13 +1664,13 @@ export async function composite(...cmds: string[]) {
.split(";")
.reduce(
async (_, cmd) => {
return cmd.split("|").reduce(
async (pipedValue, cmd) => {
let [fn, args] = excmd_parser.parser(cmd)
return fn.call({}, ...args, await pipedValue)
},
"" as any,
)
await _
let cmds = cmd.split("|")
let [fn, args] = excmd_parser.parser(cmd)
return cmds.slice(1).reduce(async (pipedValue, cmd) => {
let [fn, args] = excmd_parser.parser(cmd)
return fn.call({}, ...args, await pipedValue)
}, fn.call({}, ...args))
},
null as any,
)