mikelangelo-project / capstan

Capstan, a tool for packaging and running your application on OSv.
http://osv.io/capstan/
Other
19 stars 7 forks source link

Capstan fails to connect to started VM when sock path is too long on VirtualBox #71

Open wkozaczuk opened 7 years ago

wkozaczuk commented 7 years ago

When instance name is pretty long resulting file path length of the sock file is longer than 104 limit (https://github.com/golang/go/issues/6895) and results in the error like this:

capstan run -c 4 -v -p vbox -f "10000:10000" remote_loader_without_console2 Removing orphaned instance folder: .... Empty command line will be set for this image Created instance: remote_loader_without_console2

dial unix : connect: invalid argument

This method in hypervisor/vbox/vbox.go and hypervisor/vmv/vmw.go:

func (c *VMConfig) sockPath() string {
    if runtime.GOOS == "windows" {
        return "\\\\.\\pipe\\" + c.Name
    } else {
        return filepath.Join(c.Dir, c.Name, fmt.Sprintf("%s.sock", c.Name))
    }
}

needs to be changed to return path that is shorter than 104.