// Console allocates and runs a console tty from container // ttynum: tty number to attempt to allocate, -1 to allocate the first available tty, or 0 to allocate the console // stdinfd: fd to read input from // stdoutfd: fd to write output to // stderrfd: fd to write error output to // escape: the escape character (1 == 'a', 2 == 'b', ...) // // This function will not return until the console has been exited by the user. func (c *Container) Console(ttynum int, stdinfd, stdoutfd, stderrfd uintptr, escape int) error { // FIXME: Make idiomatic if err := c.makeSure(isDefined | isRunning); err != nil { return err } c.mu.Lock() defer c.mu.Unlock() if !bool(C.go_lxc_console(c.container, C.int(ttynum), C.int(stdinfd), C.int(stdoutfd), C.int(stderrfd), C.int(escape))) { return ErrAttachFailed } return nil }
// Console allocates and runs a console tty from container // // This function will not return until the console has been exited by the user. func (c *Container) Console(options ConsoleOptions) error { if err := c.makeSure(isRunning); err != nil { return err } c.mu.Lock() defer c.mu.Unlock() ret := bool(C.go_lxc_console(c.container, C.int(options.Tty), C.int(options.StdinFd), C.int(options.StdoutFd), C.int(options.StderrFd), C.int(options.EscapeCharacter))) if !ret { return ErrAttachFailed } return nil }