File tree Expand file tree Collapse file tree 3 files changed +24
-0
lines changed
Expand file tree Collapse file tree 3 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,14 @@ func createBaseCommand(c *Command) *exec.Cmd {
1010 return cmd
1111}
1212
13+ // WithUser allows the command to be run as a different
14+ // user.
15+ //
16+ // Example:
17+ //
18+ // cred := syscall.Credential{Uid: 1000, Gid: 1000}
19+ // c := NewCommand("echo hello", cred)
20+ // c.Execute()
1321func WithUser (credential syscall.Credential ) func (c * Command ) {
1422 return func (c * Command ) {
1523 c .baseCommand .SysProcAttr = & syscall.SysProcAttr {
Original file line number Diff line number Diff line change @@ -10,6 +10,14 @@ func createBaseCommand(c *Command) *exec.Cmd {
1010 return cmd
1111}
1212
13+ // WithUser allows the command to be run as a different
14+ // user.
15+ //
16+ // Example:
17+ //
18+ // cred := syscall.Credential{Uid: 1000, Gid: 1000}
19+ // c := NewCommand("echo hello", cred)
20+ // c.Execute()
1321func WithUser (credential syscall.Credential ) func (c * Command ) {
1422 return func (c * Command ) {
1523 c .baseCommand .SysProcAttr = & syscall.SysProcAttr {
Original file line number Diff line number Diff line change @@ -10,6 +10,14 @@ func createBaseCommand(c *Command) *exec.Cmd {
1010 return cmd
1111}
1212
13+ // WithUser allows the command to be run as a different
14+ // user.
15+ //
16+ // Example:
17+ //
18+ // token := syscall.Token(handle)
19+ // c := NewCommand("echo hello", token)
20+ // c.Execute()
1321func WithUser (token syscall.Token ) func (c * Command ) {
1422 return func (c * Command ) {
1523 c .baseCommand .SysProcAttr = & syscall.SysProcAttr {
You can’t perform that action at this time.
0 commit comments