feat(主机名称): goenv命令添加-h参数映射主机名称

This commit is contained in:
xiaoqidun 2020-10-15 18:24:17 +08:00
parent 65cfce1285
commit b9976086a1

@ -57,6 +57,9 @@ func (d *DockerGoEnv) Run() {
d.CmdArgs = append(d.CmdArgs, "-v", pwd+":"+d.WorkDir, "-w", d.WorkDir) d.CmdArgs = append(d.CmdArgs, "-v", pwd+":"+d.WorkDir, "-w", d.WorkDir)
} }
} }
if hostname, err1 := os.Hostname(); err1 == nil {
d.CmdArgs = append(d.CmdArgs, "-h", hostname)
}
d.CmdArgs = append(d.CmdArgs, d.Image) d.CmdArgs = append(d.CmdArgs, d.Image)
cmd := exec.Command(d.Binary, d.CmdArgs...) cmd := exec.Command(d.Binary, d.CmdArgs...)
cmd.Stdin = os.Stdin cmd.Stdin = os.Stdin