Skip to content

Commit 56bbdc8

Browse files
committed
Add the ability to change user on *nix systems
1 parent 4b24952 commit 56bbdc8

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ A simple package to execute shell commands on linux, darwin and windows.
1010

1111
## Installation
1212

13-
`$ go get -u github.com/commander-cli/[email protected]`
13+
```bash
14+
$ go get -u github.com/commander-cli/[email protected]
15+
```
1416

1517
## Usage
1618

command_darwin_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ func TestCommand_WithValidTimeout(t *testing.T) {
3636

3737
// I really don't see the point of mocking this
3838
// as the stdlib does so already. So testing here
39-
// seems redundant. This simply checks if we're compliant
40-
// with api changes
39+
// seems redundant. This simple check if we're compliant
40+
// with an api changes
4141
func TestCommand_WithUser(t *testing.T) {
42-
cmd := NewCommand("echo hello", WithUser(syscall.Credential{}))
42+
cmd := NewCommand("echo hello", WithUser(syscall.Credential{Uid: 1111}))
4343
err := cmd.Execute()
44+
assert.Equal(t, uint32(1111), cmd.baseCommand.SysProcAttr.Credential.Uid)
4445
assert.Error(t, err)
4546
}

0 commit comments

Comments
 (0)