Rename to tortoise

This commit is contained in:
IamTheFij 2024-10-21 17:12:14 -07:00
parent fa450dd130
commit 24d091b787
4 changed files with 13 additions and 11 deletions

View File

@ -1,3 +1,3 @@
# Go Shell Runner
# Tortoise
Library for asyncronously executing shell commands in Go

2
go.mod
View File

@ -1,3 +1,3 @@
module git.iamthefij.com/iamthefij/go-shell-runner
module git.iamthefij.com/iamthefij/tortoise
go 1.21.4

View File

@ -1,4 +1,4 @@
package shellrunner
package tortoise
import (
"bytes"

View File

@ -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()