修补程序命令的exec.command [英] exec.command for patch command
本文介绍了修补程序命令的exec.command的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用以下命令修补文件
I am trying to patch a file using the below command
patch -p0 < <file_path>
我的runCommand语法如下:
My runCommand syntax is as below:
func runCommand(cmd string, args ...string) error {
ecmd := exec.Command(cmd, args...)
ecmd.Stdout = os.Stdout
ecmd.Stderr = os.Stderr
ecmd.Stdin = os.Stdin
err := ecmd.Run()
return err
}
现在,我正在通过以下修补程序命令:
Now I am passing my patch command as below:
cmd = "patch"
args := []string{"-p0", "<", "/tmp/file"}
err = runCommand(cmd, args...)
但是我看到以下错误:
补丁:****找不到文件<" :没有这样的文件或目录
你能让我知道我在这里想念什么吗?
Can you please let me know what I am missing here?
推荐答案
查看全文