diff --git a/README.md b/README.md index 1836ff1..b533bea 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ -# Go Shell Runner +# Tortoise Library for asyncronously executing shell commands in Go diff --git a/go.mod b/go.mod index 14a150f..dbdcbba 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,3 @@ -module git.iamthefij.com/iamthefij/go-shell-runner +module git.iamthefij.com/iamthefij/tortoise go 1.21.4 diff --git a/main.go b/main.go index 606ee43..1d64e0e 100644 --- a/main.go +++ b/main.go @@ -1,4 +1,4 @@ -package shellrunner +package tortoise import ( "bytes" diff --git a/main_test.go b/main_test.go index 5147a91..d1848b6 100644 --- a/main_test.go +++ b/main_test.go @@ -1,13 +1,15 @@ -package shellrunner_test +package tortoise_test import ( "testing" "time" - shellrunner "git.iamthefij.com/iamthefij/go-shell-runner" + "git.iamthefij.com/iamthefij/tortoise" ) func TestShellRunnerNoCallback(t *testing.T) { + t.Parallel() + cases := []struct { command string output string @@ -22,7 +24,7 @@ func TestShellRunnerNoCallback(t *testing.T) { t.Run(c.command, func(t *testing.T) { t.Parallel() - runner := shellrunner.NewShellRunner() + runner := tortoise.NewShellRunner() runner.Start() // Test command without callback @@ -43,7 +45,7 @@ func TestShellRunnerNoCallback(t *testing.T) { func TestShellRunnerCallback(t *testing.T) { t.Parallel() - runner := shellrunner.NewShellRunner() + runner := tortoise.NewShellRunner() runner.Start() // Test command with callback @@ -51,7 +53,7 @@ func TestShellRunnerCallback(t *testing.T) { 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 if result.Output != "callback test\n" { t.Fatalf("expected 'callback test', got '%s'", result.Output) @@ -82,13 +84,13 @@ func TestShellRunnerCallback(t *testing.T) { func TestShellRunnerKillWithTimeout(t *testing.T) { t.Parallel() - runner := shellrunner.NewShellRunner() + runner := tortoise.NewShellRunner() runner.Start() // Test command with callback 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 if result.Output != "callback test\n" { t.Fatalf("expected 'callback test', got '%s'", result.Output) @@ -110,7 +112,7 @@ func TestShellRunnerKillWithTimeout(t *testing.T) { } func TestStopPreventsNewCommands(t *testing.T) { - runner := shellrunner.NewShellRunner() + runner := tortoise.NewShellRunner() runner.Start() runner.Stop()