...

Source file src/github.com/Microsoft/hcsshim/internal/vm/hcs/serial.go

Documentation: github.com/Microsoft/hcsshim/internal/vm/hcs

     1  //go:build windows
     2  
     3  package hcs
     4  
     5  import (
     6  	"strconv"
     7  	"strings"
     8  
     9  	hcsschema "github.com/Microsoft/hcsshim/internal/hcs/schema2"
    10  	"github.com/pkg/errors"
    11  )
    12  
    13  func (uvmb *utilityVMBuilder) SetSerialConsole(port uint32, listenerPath string) error {
    14  	if !strings.HasPrefix(listenerPath, `\\.\pipe\`) {
    15  		return errors.New("listener for serial console is not a named pipe")
    16  	}
    17  
    18  	uvmb.doc.VirtualMachine.Devices.ComPorts = map[string]hcsschema.ComPort{
    19  		strconv.Itoa(int(port)): { // "0" would be COM1
    20  			NamedPipe: listenerPath,
    21  		},
    22  	}
    23  	return nil
    24  }
    25  

View as plain text