Skip to content

Commit

Permalink
Add the ability to change user on *nix systems
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanhitt committed Nov 27, 2022
1 parent 4b24952 commit 56bbdc8
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ A simple package to execute shell commands on linux, darwin and windows.

## Installation

`$ go get -u github.com/commander-cli/[email protected]`
```bash
$ go get -u github.com/commander-cli/[email protected]
```

## Usage

Expand Down
7 changes: 4 additions & 3 deletions command_darwin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ func TestCommand_WithValidTimeout(t *testing.T) {

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

0 comments on commit 56bbdc8

Please sign in to comment.