Skip to content

Commit

Permalink
Minor refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
sestrella committed Oct 16, 2024
1 parent 7f45eec commit ecdd943
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cmd/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,25 +71,25 @@ func runExec(ctx context.Context, clusterId string, taskId string, containerId s
Interactive: interactive,
})
if err != nil {
return err
return fmt.Errorf("Error executing command: %w", err)
}
session, err := json.Marshal(output.Session)
if err != nil {
return err
return fmt.Errorf("Unable to encode session: %w", err)
}
taskArnSlices := strings.Split(*task.TaskArn, "/")
if len(taskArnSlices) < 2 {
return fmt.Errorf("Unable to extract task name from '%s'", *task.TaskArn)
}
taskName := strings.Join(taskArnSlices[1:], "/")
var target = fmt.Sprintf("ecs:%s_%s_%s", *cluster.ClusterName, taskName, *container.RuntimeId)
target := fmt.Sprintf("ecs:%s_%s_%s", *cluster.ClusterName, taskName, *container.RuntimeId)
targetJSON, err := json.Marshal(ssm.StartSessionInput{
Target: &target,
})
if err != nil {
return err
}
pterm.Info.Printfln("interactive-ecs exec --cluster %s --task %s --container %s --command \"%s\" --interactive %t\n",
pterm.Info.Printfln("iecs exec --cluster %s --task %s --container %s --command \"%s\" --interactive %t\n",
*cluster.ClusterName,
taskName,
*container.Name,
Expand Down

0 comments on commit ecdd943

Please sign in to comment.