Deal with /usr/bin/sleep on github (seriously?)

This commit is contained in:
Justin Hawkins 2023-11-28 20:11:31 +10:30
parent 73833a1a14
commit b0048a5764

View File

@ -367,17 +367,23 @@ func TestLookForExecutable(t *testing.T) {
cmd := "sleep"
path, err := absPathToExecutable(cmd)
if assert.NoError(t, err) {
assert.Equal(t, path, "/bin/sleep")
if path != "/bin/sleep" && path != "/usr/bin/sleep" {
t.Errorf("bad path: %s", path)
}
}
cmd = "/bin/sleep"
path, err = absPathToExecutable(cmd)
if assert.NoError(t, err) {
assert.Equal(t, path, "/bin/sleep")
if path != "/bin/sleep" && path != "/usr/bin/sleep" {
t.Errorf("bad path: %s", path)
}
}
cmd = "../../../../../bin/sleep"
path, err = absPathToExecutable(cmd)
if assert.NoError(t, err) {
assert.Equal(t, path, "/bin/sleep")
if path != "/bin/sleep" && path != "/usr/bin/sleep" {
t.Errorf("bad path: %s", path)
}
}
cmd = "./sleep"
_, err = absPathToExecutable(cmd)
@ -387,7 +393,9 @@ func TestLookForExecutable(t *testing.T) {
cmd = "./sleep"
path, err = absPathToExecutable(cmd)
if assert.NoError(t, err) {
assert.Equal(t, path, "/bin/sleep")
if path != "/bin/sleep" && path != "/usr/bin/sleep" {
t.Errorf("bad path: %s", path)
}
}
}