From 2ee13137e954b476b178a75cd5c43119165f5189 Mon Sep 17 00:00:00 2001 From: dylanhitt Date: Mon, 14 Nov 2022 21:22:29 -0500 Subject: [PATCH] Add the ability to change user on *nix systems --- README.md | 4 +++- command_darwin_test.go | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 30585d7..13bcbb8 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,9 @@ A simple package to execute shell commands on linux, darwin and windows. ## Installation -`$ go get -u github.com/commander-cli/cmd@v1.5.0` +```bash +$ go get -u github.com/commander-cli/cmd@v1.5.0 +``` ## Usage diff --git a/command_darwin_test.go b/command_darwin_test.go index 057b75a..7a575ba 100644 --- a/command_darwin_test.go +++ b/command_darwin_test.go @@ -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) }