aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/main.go31
1 files changed, 12 insertions, 19 deletions
diff --git a/app/main.go b/app/main.go
index d1c4195..7e73cbd 100644
--- a/app/main.go
+++ b/app/main.go
@@ -2,27 +2,20 @@ package main
import (
"fmt"
- // Uncomment this block to pass the first stage!
- // "os"
- // "os/exec"
+ "os"
+ "os/exec"
)
-// Usage: your_docker.sh run <image> <command> <arg1> <arg2> ...
func main() {
- // You can use print statements as follows for debugging, they'll be visible when running tests.
- fmt.Println("Logs from your program will appear here!")
+ command := os.Args[3]
+ args := os.Args[4:len(os.Args)]
- // Uncomment this block to pass the first stage!
- //
- // command := os.Args[3]
- // args := os.Args[4:len(os.Args)]
- //
- // cmd := exec.Command(command, args...)
- // output, err := cmd.Output()
- // if err != nil {
- // fmt.Printf("Err: %v", err)
- // os.Exit(1)
- // }
- //
- // fmt.Println(string(output))
+ cmd := exec.Command(command, args...)
+ output, err := cmd.Output()
+ if err != nil {
+ fmt.Printf("Err: %v", err)
+ os.Exit(1)
+ }
+
+ fmt.Println(string(output))
}