On Sun, Apr 5, 2020 at 3:36 PM R Srinivasan wrote:
>
> I cannot figure the error in the following.
> package main
>
> import (
> "io"
> "os"
> "os/exec"
> "strings"
> )
>
> func Run(args []string) {
> lf, _ := os.Create("lf.log")
> defer lf.Close()
> cmd := exec.Command(args[0], strings.Join(args[
On Sun, Apr 5, 2020 at 4:36 PM R Srinivasan wrote:
>
> I cannot figure the error in the following.
> cmd := exec.Command(args[0], strings.Join(args[1:], " "))
Do not join the args. You're passing one arg, "build ./", instead of
two args "build" "./" to exec. Instead:
cmd := exec.Command(args[0],
I cannot figure the error in the following.
package main
import (
"io"
"os"
"os/exec"
"strings"
)
func Run(args []string) {
lf, _ := os.Create("lf.log")
defer lf.Close()
cmd := exec.Command(args[0], strings.Join(args[1:], " "))
stderr, _ := cmd.StderrPipe()
cmd.Start()
io.Copy(lf, stderr)
cmd.Wai