internal/stack: Cleanup API

This commit cleans up the internal stack API to prepare it for an
eventual move to using a native docker client.
This commit is contained in:
Tom Wiesing 2022-09-02 17:52:06 +02:00
parent 7b38fdd801
commit 5d906169f4
No known key found for this signature in database
15 changed files with 96 additions and 65 deletions

View file

@ -32,13 +32,21 @@ func (shell) Description() wisski_distillery.Description {
}
}
var errShell = exit.Error{
Message: "Unable to start shell: %s",
ExitCode: exit.ExitGeneric,
}
func (sh shell) Run(context wisski_distillery.Context) error {
instance, err := context.Environment.Instance(sh.Positionals.Slug)
if err != nil {
return err
}
code := instance.Shell(context.IOStream, sh.Positionals.Args...)
code, err := instance.Shell(context.IOStream, sh.Positionals.Args...)
if err != nil {
return errShell.WithMessageF(err)
}
if code != 0 {
return exit.Error{
ExitCode: exit.ExitCode(uint8(code)),