f49c280a7f
SysProcAttr.Credential is not available on Windows we need to move the WrapCmd test in a separate file to be able to build test cases on Windows, skipping the test is not enough
19 lines
317 B
Go
19 lines
317 B
Go
// +build !windows
|
|
|
|
package sftpd
|
|
|
|
import (
|
|
"os/exec"
|
|
"testing"
|
|
)
|
|
|
|
func TestWrapCmd(t *testing.T) {
|
|
cmd := exec.Command("ls")
|
|
cmd = wrapCmd(cmd, 1000, 1001)
|
|
if cmd.SysProcAttr.Credential.Uid != 1000 {
|
|
t.Errorf("unexpected uid")
|
|
}
|
|
if cmd.SysProcAttr.Credential.Gid != 1001 {
|
|
t.Errorf("unexpected gid")
|
|
}
|
|
}
|