It would exec.Command returns the result code of the process not whether it was
able to be executed.
> On Feb 17, 2020, at 7:51 PM, Dan Kortschak wrote:
>
> What do you see when you
>
> bash -c "lspci | grep -i vga | grep -i nvidia"
> echo $?
>
> If you have no nvidia line or no vga line i
What do you see when you
bash -c "lspci | grep -i vga | grep -i nvidia"
echo $?
If you have no nvidia line or no vga line in lspci, this will output 1.
On Mon, 2020-02-17 at 14:41 -0800, Dean Schulze wrote:
> This command always sets the err to "exit status 1" even though it
> executes correctl
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 := util.Copy(srcPath, dst)
>>
>> If i could modify
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 filepath.Abs(filepath.
On 17 January 2017 at 18:50, Deepak Jain wrote:
> 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 conte
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 := util.Copy(srcPath, dst)
>
> If i co
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 acces
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) er
You don't really need to use the external cp command:
https://play.golang.org/p/F1YHzQL4UN
On 16 January 2017 at 21:35, Deepak Jain wrote:
> util.ExecuteCommandWithOuput(exec.Command("cp", "-r", "./*.json",
> artifact.dir))
>
> func ExecuteCommandWithOuput(cmd *exec.Cmd) {
> output, err := cmd.O
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 ", cmd.Args, err)
> }
>
Thanks for Stderr.
I would like to do a recursive copy of a directory (similar to cp -r ),
directory can contain files (binaries or text files) and directories.
I now see
exit status 1: cp: ./*.json: No such file or directory
Code:
//ExecuteCommandWithOuput will execute cmd passed as argumen
Before answering the questions below, you should know that exec.Command
will not do shell glob expansion since it does not invoke commands via
a shell. If you want to do that you can either invoke via a shell or do
the globbing yourself with filepath.Glob[1].
1. You can capture the combined output
* hadiesmail...@gmail.com [161005 05:46]:
> hi
>
> in the second arg in function exec.Command(), what i must put it??
>
> and any my question is :
>
> i want run a cmd command.for example : cls
>
> how can i run this method?
The second argument is a variadic argument, so you can omit it; see
13 matches
Mail list logo