mirror of
https://github.com/alibaba/higress.git
synced 2026-04-22 04:27:26 +08:00
tools(hgctl): add windows build (#739)
Signed-off-by: Ink33 <Ink33@smlk.org>
This commit is contained in:
@@ -20,10 +20,8 @@ import (
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"os/signal"
|
||||
"os/user"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"github.com/alibaba/higress/pkg/cmd/hgctl/plugin/option"
|
||||
ptypes "github.com/alibaba/higress/pkg/cmd/hgctl/plugin/types"
|
||||
@@ -633,11 +631,7 @@ func (b *Builder) config(f ConfigFunc) (err error) {
|
||||
b.w = os.Stdout
|
||||
}
|
||||
|
||||
b.sig = make(chan os.Signal, 1)
|
||||
b.stop = make(chan struct{}, 1)
|
||||
b.done = make(chan struct{}, 1)
|
||||
signal.Notify(b.sig, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM,
|
||||
syscall.SIGUSR1, syscall.SIGUSR2, syscall.SIGQUIT, syscall.SIGTSTP)
|
||||
signalNotify(b)
|
||||
|
||||
if b.Debugger == nil {
|
||||
b.Debugger = utils.NewDefaultDebugger(b.Debug, b.w)
|
||||
|
||||
31
pkg/cmd/hgctl/plugin/build/signal.go
Normal file
31
pkg/cmd/hgctl/plugin/build/signal.go
Normal file
@@ -0,0 +1,31 @@
|
||||
// Copyright (c) 2022 Alibaba Group Holding Ltd.
|
||||
//
|
||||
// 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.
|
||||
|
||||
//go:build linux || darwin || bsd
|
||||
|
||||
package build
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func signalNotify(b *Builder) {
|
||||
b.sig = make(chan os.Signal, 1)
|
||||
b.stop = make(chan struct{}, 1)
|
||||
b.done = make(chan struct{}, 1)
|
||||
signal.Notify(b.sig, syscall.SIGHUP, syscall.SIGINT, syscall.SIGTERM,
|
||||
syscall.SIGUSR1, syscall.SIGUSR2, syscall.SIGQUIT, syscall.SIGTSTP)
|
||||
}
|
||||
31
pkg/cmd/hgctl/plugin/build/signal_windows.go
Normal file
31
pkg/cmd/hgctl/plugin/build/signal_windows.go
Normal file
@@ -0,0 +1,31 @@
|
||||
// Copyright (c) 2022 Alibaba Group Holding Ltd.
|
||||
//
|
||||
// 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.
|
||||
|
||||
//go:build windows
|
||||
|
||||
package build
|
||||
|
||||
import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"syscall"
|
||||
)
|
||||
|
||||
func signalNotify(b *Builder) {
|
||||
b.sig = make(chan os.Signal, 1)
|
||||
b.stop = make(chan struct{}, 1)
|
||||
b.done = make(chan struct{}, 1)
|
||||
signal.Notify(b.sig, syscall.SIGHUP, syscall.SIGINT,
|
||||
syscall.SIGTERM, syscall.SIGQUIT)
|
||||
}
|
||||
Reference in New Issue
Block a user