pkg/environment: Remove exec related functions

This commit starts the migration to remove the environment package. It
introduced an abstraction that is not being used, and removing it makes
the code simpler to maintain.

This commit removes all 'exec' related package.
This commit is contained in:
Tom Wiesing 2023-03-02 11:03:33 +01:00
parent 066390e30d
commit 14bb7f1086
No known key found for this signature in database
6 changed files with 32 additions and 25 deletions

View file

@ -1,12 +1,10 @@
package environment
import (
"context"
"io"
"io/fs"
"os"
"github.com/tkw1536/goprogram/stream"
"github.com/tkw1536/pkglib/pools"
)
@ -70,8 +68,3 @@ func ReadFile(env Environment, path string) ([]byte, error) {
// return the buffer contents!
return buffer.Bytes(), nil
}
// MustExec is like Exec, except that it returns true if the command exited successfully, and else false.
func MustExec(ctx context.Context, env Environment, io stream.IOStream, workdir string, exe string, argv ...string) bool {
return env.Exec(ctx, io, workdir, exe, argv...)() == 0
}