From c1b7279d31b7efbcfcdaf078925c43c6909b7ce5 Mon Sep 17 00:00:00 2001 From: "Ward Nakchbandi (Cosmic Fusion)" Date: Tue, 22 Aug 2023 17:35:23 +0300 Subject: [PATCH] Add some of ferreo requests --- command/command.go | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-) diff --git a/command/command.go b/command/command.go index 8b7f023..a2e66b3 100644 --- a/command/command.go +++ b/command/command.go @@ -80,21 +80,16 @@ func (c *Command) processCommand() error { cmd := exec.Command("/bin/bash", "-c", "apx subsystems list | grep ^" + c.ContainerSubsystem() + "$") cmd.Stdin = os.Stdin cmd.Stderr = os.Stderr - if err != nil { - fmt.Println("Error 1") - } - if err := cmd.Start(); err != nil { - fmt.Println("Error 2") - } - if err != nil { - fmt.Println("Error 3") - } + cmd.Stdout = os.Stdout if err := cmd.Wait(); err != nil { fmt.Println("Warning: Subsystem hasn't been pre-initialized, initializing...") cmd_exec := exec.Command("/bin/bash", "-c", "apx subsystems new -n " + c.ContainerSubsystem() + " -s " + c.ApxSubsystem()) + cmd_exec.Stdin = os.Stdin + cmd_exec.Stderr = os.Stderr cmd_exec.Stdout = os.Stdout if err := cmd_exec.Run(); err != nil { fmt.Println("Apx Error: ", err) + return err } } } @@ -103,21 +98,16 @@ func (c *Command) processCommand() error { cmd := exec.Command("/bin/bash", "-c", "apx subsystems list | grep ^" + c.ContainerName + "$") cmd.Stdin = os.Stdin cmd.Stderr = os.Stderr - if err != nil { - fmt.Println("Error 1") - } - if err := cmd.Start(); err != nil { - fmt.Println("Error 2") - } - if err != nil { - fmt.Println("Error 3") - } + cmd.Stdout = os.Stdout if err := cmd.Wait(); err != nil { fmt.Println("Warning: Subsystem hasn't been pre-initialized, initializing...") cmd_exec := exec.Command("/bin/bash", "-c", "apx subsystems new -n " + c.ContainerName + " -s " + c.ApxSubsystem()) + cmd_exec.Stdin = os.Stdin + cmd_exec.Stderr = os.Stderr cmd_exec.Stdout = os.Stdout - if err := cmd_exec.Run(); err != nil { + if err := cmd_exec.Run(); err != nil { fmt.Println("Apx Error: ", err) + return err } } }