From f75626c09e0497078c3af0efebe1c5fc19905ed8 Mon Sep 17 00:00:00 2001 From: jet2tlf Date: Mon, 3 Jun 2024 03:15:32 -0300 Subject: codecrafters submit [skip ci] --- app/main.go | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) (limited to 'app/main.go') 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 ... 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)) } -- cgit v1.2.3