elvish/util/fullnames_unix_test.go

21 lines
334 B
Go
Raw Normal View History

2017-12-08 08:45:10 +08:00
// +build !windows,!plan9
2017-12-07 00:58:26 +08:00
package util
import (
"os/exec"
"sort"
"strings"
)
func ls(dir string) []string {
output, err := exec.Command("ls", dir).Output()
mustOK(err)
names := strings.Split(strings.Trim(string(output), "\n"), "\n")
for i := range names {
names[i] = dir + names[i]
}
sort.Strings(names)
return names
}