* Make `async:true` the default for `invoke` calls (#3750) * Switch away from native grpc impl. (#3728) * Remove usage of the 'deasync' library from @pulumi/pulumi. (#3752) * Only retry as long as we get unavailable back. Anything else continues. (#3769) * Handle all errors for now. (#3781) * Do not assume --yes was present when using pulumi in non-interactive mode (#3793) * Upgrade all paths for sdk and pkg to v2 * Backport C# invoke classes and other recent gen changes (#4288) Adjust C# generation * Replace IDeployment with a sealed class (#4318) Replace IDeployment with a sealed class * .NET: default to args subtype rather than Args.Empty (#4320) * Adding system namespace for Dotnet code gen This is required for using Obsolute attributes for deprecations ``` Iam/InstanceProfile.cs(142,10): error CS0246: The type or namespace name 'ObsoleteAttribute' could not be found (are you missing a using directive or an assembly reference?) [/Users/stack72/code/go/src/github.com/pulumi/pulumi-aws/sdk/dotnet/Pulumi.Aws.csproj] Iam/InstanceProfile.cs(142,10): error CS0246: The type or namespace name 'Obsolete' could not be found (are you missing a using directive or an assembly reference?) [/Users/stack72/code/go/src/github.com/pulumi/pulumi-aws/sdk/dotnet/Pulumi.Aws.csproj] ``` * Fix the nullability of config type properties in C# codegen (#4379)
113 lines
2.8 KiB
Go
113 lines
2.8 KiB
Go
// Copyright 2016-2018, Pulumi Corporation.
|
|
//
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
//
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
// See the License for the specific language governing permissions and
|
|
// limitations under the License.
|
|
|
|
//+build windows
|
|
|
|
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"io"
|
|
"net"
|
|
"os"
|
|
"time"
|
|
|
|
winio "github.com/Microsoft/go-winio"
|
|
|
|
"github.com/pulumi/pulumi/sdk/v2/go/common/util/logging"
|
|
)
|
|
|
|
// Windows specific pipe implementation. Slightly complex as it sits on top of a pair of named pipes
|
|
// that have to asynchronously accept connections to. But also fairly simple as windows will take
|
|
// care of cleaning things up once our processes complete.
|
|
func createPipes() (pipes, error) {
|
|
// Generate a random pipe name so that we don't collide with other pipes made by other pulumi
|
|
// instances.
|
|
rand := uint32(time.Now().UnixNano() + int64(os.Getpid()))
|
|
dir := fmt.Sprintf(`\\.\pipe\pulumi%v`, rand)
|
|
|
|
reqPipeName := dir + `\invoke_req`
|
|
resPipeName := dir + `\invoke_res`
|
|
reqListener, err := winio.ListenPipe(reqPipeName, nil)
|
|
if err != nil {
|
|
logging.V(10).Infof("createPipes: Received error trying to create request pipe %s: %s\n", reqPipeName, err)
|
|
return nil, err
|
|
}
|
|
|
|
resListener, err := winio.ListenPipe(resPipeName, nil)
|
|
if err != nil {
|
|
logging.V(10).Infof("createPipes: Received error trying to create response pipe %s: %s\n", resPipeName, err)
|
|
return nil, err
|
|
}
|
|
return &windowsPipes{
|
|
dir: dir,
|
|
reqListener: reqListener,
|
|
resListener: resListener,
|
|
}, nil
|
|
}
|
|
|
|
type windowsPipes struct {
|
|
dir string
|
|
reqListener, resListener net.Listener
|
|
reqConn, resConn net.Conn
|
|
}
|
|
|
|
func (p *windowsPipes) directory() string {
|
|
return p.dir
|
|
}
|
|
|
|
func (p *windowsPipes) reader() io.Reader {
|
|
return p.reqConn
|
|
}
|
|
|
|
func (p *windowsPipes) writer() io.Writer {
|
|
return p.resConn
|
|
}
|
|
|
|
func (p *windowsPipes) connect() error {
|
|
acceptDone := make(chan error)
|
|
defer close(acceptDone)
|
|
|
|
go func() {
|
|
reqConn, err := p.reqListener.Accept()
|
|
if err != nil {
|
|
acceptDone <- err
|
|
}
|
|
p.reqConn = reqConn
|
|
acceptDone <- nil
|
|
}()
|
|
|
|
go func() {
|
|
resConn, err := p.resListener.Accept()
|
|
if err != nil {
|
|
acceptDone <- err
|
|
}
|
|
p.resConn = resConn
|
|
acceptDone <- nil
|
|
}()
|
|
|
|
res1 := <-acceptDone
|
|
res2 := <-acceptDone
|
|
|
|
if res1 != nil {
|
|
return res1
|
|
}
|
|
|
|
return res2
|
|
}
|
|
|
|
func (p *windowsPipes) shutdown() {
|
|
// Don't need to do anything here. Named pipes are cleaned up when all processes that are using
|
|
// them terminate.
|
|
}
|