vorteil/vorteil

View on GitHub
pkg/virtualizers/hyperv/virtualizer_windows.go

Summary

Maintainability
A
0 mins
Test Coverage
// +build windows

package hyperv

/**
 * SPDX-License-Identifier: Apache-2.0
 * Copyright 2020 vorteil.io Pty Ltd
 */

import (
    "fmt"
    "io"

    "github.com/natefinch/npipe"
)

// initLogs setups the ability to read from the pipe
func (v *Virtualizer) initLogs() error {
    conn, err := npipe.Dial(fmt.Sprintf("\\\\.\\pipe\\%s", v.id))
    if err != nil {
        v.logger.Errorf("Error Dialing Pipe: %s", err.Error())
        return err
    }
    v.sock = conn

    go io.Copy(v.serialLogger, v.sock)
    return nil
}