Rename to tortoise
This commit is contained in:
parent
fa450dd130
commit
24d091b787
@ -1,3 +1,3 @@
|
|||||||
# Go Shell Runner
|
# Tortoise
|
||||||
|
|
||||||
Library for asyncronously executing shell commands in Go
|
Library for asyncronously executing shell commands in Go
|
||||||
|
2
go.mod
2
go.mod
@ -1,3 +1,3 @@
|
|||||||
module git.iamthefij.com/iamthefij/go-shell-runner
|
module git.iamthefij.com/iamthefij/tortoise
|
||||||
|
|
||||||
go 1.21.4
|
go 1.21.4
|
||||||
|
2
main.go
2
main.go
@ -1,4 +1,4 @@
|
|||||||
package shellrunner
|
package tortoise
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
18
main_test.go
18
main_test.go
@ -1,13 +1,15 @@
|
|||||||
package shellrunner_test
|
package tortoise_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
shellrunner "git.iamthefij.com/iamthefij/go-shell-runner"
|
"git.iamthefij.com/iamthefij/tortoise"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestShellRunnerNoCallback(t *testing.T) {
|
func TestShellRunnerNoCallback(t *testing.T) {
|
||||||
|
t.Parallel()
|
||||||
|
|
||||||
cases := []struct {
|
cases := []struct {
|
||||||
command string
|
command string
|
||||||
output string
|
output string
|
||||||
@ -22,7 +24,7 @@ func TestShellRunnerNoCallback(t *testing.T) {
|
|||||||
t.Run(c.command, func(t *testing.T) {
|
t.Run(c.command, func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
runner := shellrunner.NewShellRunner()
|
runner := tortoise.NewShellRunner()
|
||||||
runner.Start()
|
runner.Start()
|
||||||
|
|
||||||
// Test command without callback
|
// Test command without callback
|
||||||
@ -43,7 +45,7 @@ func TestShellRunnerNoCallback(t *testing.T) {
|
|||||||
func TestShellRunnerCallback(t *testing.T) {
|
func TestShellRunnerCallback(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
runner := shellrunner.NewShellRunner()
|
runner := tortoise.NewShellRunner()
|
||||||
runner.Start()
|
runner.Start()
|
||||||
|
|
||||||
// Test command with callback
|
// Test command with callback
|
||||||
@ -51,7 +53,7 @@ func TestShellRunnerCallback(t *testing.T) {
|
|||||||
|
|
||||||
callbackReached := false
|
callbackReached := false
|
||||||
|
|
||||||
if err := runner.AddCommand("echo callback test", func(result *shellrunner.CommandResult) {
|
if err := runner.AddCommand("echo callback test", func(result *tortoise.CommandResult) {
|
||||||
callbackReached = true
|
callbackReached = true
|
||||||
if result.Output != "callback test\n" {
|
if result.Output != "callback test\n" {
|
||||||
t.Fatalf("expected 'callback test', got '%s'", result.Output)
|
t.Fatalf("expected 'callback test', got '%s'", result.Output)
|
||||||
@ -82,13 +84,13 @@ func TestShellRunnerCallback(t *testing.T) {
|
|||||||
func TestShellRunnerKillWithTimeout(t *testing.T) {
|
func TestShellRunnerKillWithTimeout(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
runner := shellrunner.NewShellRunner()
|
runner := tortoise.NewShellRunner()
|
||||||
runner.Start()
|
runner.Start()
|
||||||
|
|
||||||
// Test command with callback
|
// Test command with callback
|
||||||
callbackReached := false
|
callbackReached := false
|
||||||
|
|
||||||
if err := runner.AddCommand("sleep 10 && echo callback test", func(result *shellrunner.CommandResult) {
|
if err := runner.AddCommand("sleep 10 && echo callback test", func(result *tortoise.CommandResult) {
|
||||||
callbackReached = true
|
callbackReached = true
|
||||||
if result.Output != "callback test\n" {
|
if result.Output != "callback test\n" {
|
||||||
t.Fatalf("expected 'callback test', got '%s'", result.Output)
|
t.Fatalf("expected 'callback test', got '%s'", result.Output)
|
||||||
@ -110,7 +112,7 @@ func TestShellRunnerKillWithTimeout(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestStopPreventsNewCommands(t *testing.T) {
|
func TestStopPreventsNewCommands(t *testing.T) {
|
||||||
runner := shellrunner.NewShellRunner()
|
runner := tortoise.NewShellRunner()
|
||||||
runner.Start()
|
runner.Start()
|
||||||
|
|
||||||
runner.Stop()
|
runner.Stop()
|
||||||
|
Loading…
Reference in New Issue
Block a user