Closed
Description
In the following example pipe, if the glob matches zero files, then a single empty line is supplied to ExecForEach()
, which causes the rm
command to error:
_, err := script.ListFiles("PY*").ExecForEach("rm -v {{.}}").Stdout()
Can ListFiles()
only produce an output if files are matched?
There is a rather ugly workaround that filters blank lines as follows:
_, err := script.ListFiles("PY*").RejectRegexp(regexp.MustCompile("^$")).ExecForEach("rm -v {{.}}").Stdout()
Metadata
Metadata
Assignees
Labels
No labels