-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ssh_executor): Sudo option (#488)
* feat(ssh_executor): Sudo option Signed-off-by: Louis-Quentin <[email protected]> * feat(ssh_executor): add sudo option Signed-off-by: Louis-Quentin <[email protected]> * feat(ssh_executor): typo in test Signed-off-by: Louis-Quentin <[email protected]>
- Loading branch information
1 parent
bc593f6
commit 3d44aa6
Showing
5 changed files
with
176 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
package ssh | ||
|
||
import ( | ||
"bytes" | ||
"sync" | ||
) | ||
|
||
// Buffer thread safe | ||
type Buffer struct { | ||
b bytes.Buffer | ||
m sync.Mutex | ||
} | ||
|
||
// Read thread safe | ||
func (b *Buffer) Read(p []byte) (n int, err error) { | ||
b.m.Lock() | ||
defer b.m.Unlock() | ||
return b.b.Read(p) | ||
} | ||
|
||
// Write thread safe | ||
func (b *Buffer) Write(p []byte) (n int, err error) { | ||
b.m.Lock() | ||
defer b.m.Unlock() | ||
return b.b.Write(p) | ||
} | ||
|
||
// String thread safe | ||
func (b *Buffer) String() string { | ||
b.m.Lock() | ||
defer b.m.Unlock() | ||
return b.b.String() | ||
} | ||
|
||
// Bytes thread safe | ||
func (b *Buffer) Bytes() []byte { | ||
b.m.Lock() | ||
defer b.m.Unlock() | ||
return b.b.Bytes() | ||
} | ||
|
||
// Len thread safe | ||
func (b *Buffer) Len() int { | ||
b.m.Lock() | ||
defer b.m.Unlock() | ||
return b.b.Len() | ||
} | ||
|
||
// Truncate thread safe | ||
func (b *Buffer) Truncate(n int) { | ||
b.m.Lock() | ||
defer b.m.Unlock() | ||
b.b.Truncate(n) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters