Skip to content

Commit dc381dd

Browse files
authored
Merge pull request #73 from peg/staging
fix(build): Windows cross-compilation for v0.4.3
2 parents 2b94a8e + b009cc4 commit dc381dd

File tree

4 files changed

+51
-2
lines changed

4 files changed

+51
-2
lines changed

cmd/rampart/cli/serve.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ func newServeCmd(opts *rootOptions, deps *serveDeps) *cobra.Command {
114114
child := exec.Command(exePath, childArgs...)
115115
child.Stdout = logFile
116116
child.Stderr = logFile
117-
child.SysProcAttr = &syscall.SysProcAttr{Setsid: true}
117+
setDetachAttrs(child)
118118

119119
if err := child.Start(); err != nil {
120120
return fmt.Errorf("serve: start background process: %w", err)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2026 The Rampart Authors
2+
// Licensed under the Apache License, Version 2.0 (the "License");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
//
6+
// http://www.apache.org/licenses/LICENSE-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
14+
//go:build !windows
15+
16+
package cli
17+
18+
import (
19+
"os/exec"
20+
"syscall"
21+
)
22+
23+
// setDetachAttrs configures the command to run in a new session (detached
24+
// from the parent terminal) on Unix systems.
25+
func setDetachAttrs(cmd *exec.Cmd) {
26+
cmd.SysProcAttr = &syscall.SysProcAttr{Setsid: true}
27+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2026 The Rampart Authors
2+
// Licensed under the Apache License, Version 2.0 (the "License");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
//
6+
// http://www.apache.org/licenses/LICENSE-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
14+
//go:build windows
15+
16+
package cli
17+
18+
import "os/exec"
19+
20+
// setDetachAttrs is a no-op on Windows; background detachment via
21+
// Setsid is not supported. The process runs without a new session.
22+
func setDetachAttrs(_ *exec.Cmd) {}

cmd/rampart/cli/upgrade.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ func replaceExecutableAtomically(path string, payload []byte, deps upgradeDeps)
637637
}
638638

639639
func isPermissionError(err error) bool {
640-
return errors.Is(err, os.ErrPermission) || errors.Is(err, syscall.EACCES) || errors.Is(err, syscall.EPERM)
640+
return os.IsPermission(err) || errors.Is(err, os.ErrPermission)
641641
}
642642

643643
func fixStalePathCopies(out io.Writer, installedBinary string, deps upgradeDeps) {

0 commit comments

Comments
 (0)