Re: [go-nuts] exec.Command("cp", "-r", "./*.json", artifact.dir fails with exit status 1

2017-01-18 Thread ๏̯͡๏
Thanks for time in responding. Appreciate. On Wed, Jan 18, 2017 at 1:46 PM, roger peppe wrote: > > > On 17 January 2017 at 19:14, Deepak Jain wrote: > >> I fixed the error by invoking Copy command with abs source path. >> >> srcPath, _ := >> e :=

Re: [go-nuts] exec.Command("cp", "-r", "./*.json", artifact.dir fails with exit status 1

2017-01-18 Thread roger peppe
On 17 January 2017 at 19:14, Deepak Jain wrote: > I fixed the error by invoking Copy command with abs source path. > > srcPath, _ := > e := util.Copy(srcPath, dst) > > If i could modify into a single line > > util.Copy(filepath.Abs(filepath.Dir(src)), dst) > Throws error as

Re: [go-nuts] exec.Command("cp", "-r", "./*.json", artifact.dir fails with exit status 1

2017-01-17 Thread Matt Harden
In Go, don't try to combine those actions into a single line. Also you shouldn't ignore the error from filepath.Abs. On Tue, Jan 17, 2017 at 11:14 AM Deepak Jain wrote: > I fixed the error by invoking Copy command with abs source path. > > srcPath, _ := > e :=

Re: [go-nuts] exec.Command("cp", "-r", "./*.json", artifact.dir fails with exit status 1

2017-01-17 Thread Deepak Jain
I fixed the error by invoking Copy command with abs source path. srcPath, _ := e := util.Copy(srcPath, dst) If i could modify into a single line util.Copy(filepath.Abs(filepath.Dir(src)), dst) Throws error as filepath.Abs(filepath.Dir(src)) returns a tuple. In scala i can use _1, _2 to

Re: [go-nuts] exec.Command("cp", "-r", "./*.json", artifact.dir fails with exit status 1

2017-01-17 Thread Deepak Jain
Thanks for pointing to https://github.com/juju/utils/blob/master/fs/copy.go I was testing Copy function that recursively copies directories. I am able to copy first level of files and it creates directories. It fails to copy the contents within those directories. func Copy(src, dst string)

Re: [go-nuts] exec.Command("cp", "-r", "./*.json", artifact.dir fails with exit status 1

2017-01-16 Thread Konstantin Khomoutov
On Mon, 16 Jan 2017 13:35:07 -0800 (PST) Deepak Jain wrote: > util.ExecuteCommandWithOuput(exec.Command("cp", "-r", "./*.json", > artifact. dir)) > > func ExecuteCommandWithOuput(cmd *exec.Cmd) { > output, err := cmd.Output() > if err != nil { > log.Print("Error executing

[go-nuts] exec.Command("cp", "-r", "./*.json", artifact.dir fails with exit status 1

2017-01-16 Thread Deepak Jain
util.ExecuteCommandWithOuput(exec.Command("cp", "-r", "./*.json", artifact. dir)) func ExecuteCommandWithOuput(cmd *exec.Cmd) { output, err := cmd.Output() if err != nil { log.Print("Error executing ", cmd.Args, err) } fmt.Print(string(output)) } Output 2017/01/16 13:26:35 Error executing [cp