diff options
| author | jet2tlf <jet2tlf@gmail.com> | 2024-06-03 06:15:32 +0000 |
|---|---|---|
| committer | jet2tlf <jet2tlf@gmail.com> | 2024-06-03 06:15:32 +0000 |
| commit | f75626c09e0497078c3af0efebe1c5fc19905ed8 (patch) | |
| tree | 57e5aa6e99f93e5cddeacd58e0d739674d2aac0b /app/main.go | |
| parent | bab5e32bd62071304ec1cd865859e685bf6d9b23 (diff) | |
| download | docker-go-f75626c09e0497078c3af0efebe1c5fc19905ed8.tar.gz docker-go-f75626c09e0497078c3af0efebe1c5fc19905ed8.zip | |
codecrafters submit [skip ci]
Diffstat (limited to 'app/main.go')
| -rw-r--r-- | app/main.go | 31 |
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)) } |