2019-12-26 07:29:38 +00:00
|
|
|
// +build !windows
|
|
|
|
|
|
|
|
package sftpd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os/exec"
|
|
|
|
"testing"
|
2020-05-06 17:36:34 +00:00
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
2019-12-26 07:29:38 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestWrapCmd(t *testing.T) {
|
|
|
|
cmd := exec.Command("ls")
|
|
|
|
cmd = wrapCmd(cmd, 1000, 1001)
|
2020-05-06 17:36:34 +00:00
|
|
|
assert.Equal(t, uint32(1000), cmd.SysProcAttr.Credential.Uid)
|
|
|
|
assert.Equal(t, uint32(1001), cmd.SysProcAttr.Credential.Gid)
|
2019-12-26 07:29:38 +00:00
|
|
|
}
|