Skip to content

Commit 096d06e

Browse files
committed
Add Windows support
1 parent a587531 commit 096d06e

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ CMD_PATH := cmd/git-remote-https+iap
22
CMD_NAME := git-remote-https+iap
33
BUILD_TARGETS := \
44
darwin-amd64 \
5-
linux-amd64
5+
linux-amd64 \
6+
windows-amd64
67

78
DIST_PATH := dist/
89
BIN_PATH := $(DIST_PATH)bin/

internal/git/git.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"os/exec"
99
"regexp"
1010
"strings"
11-
"syscall"
1211

1312
"github.com/rs/zerolog/log"
1413
)
@@ -61,9 +60,19 @@ func PassThruRemoteHTTPSHelper(remote, url string) {
6160
log.Fatal().Msgf("passThruRemoteHTTPSHelper - %s", err.Error())
6261
}
6362

64-
env := os.Environ()
65-
if err := syscall.Exec(binary, args, env); err != nil {
66-
log.Fatal().Msgf("passThruRemoteHTTPSHelper - %s", err.Error())
63+
procAttr := &os.ProcAttr{Env: os.Environ(), Files: []*os.File{os.Stdin, os.Stdout, os.Stderr}}
64+
process, err := os.StartProcess(binary, args, procAttr)
65+
if err != nil {
66+
log.Fatal().Msgf("passThruRemoteHTTPSHelper: failed starting remote-https - %s", err.Error())
67+
}
68+
69+
processState, err := process.Wait()
70+
if err != nil {
71+
log.Fatal().Msgf("passThruRemoteHTTPSHelper: failed waiting on remote-https - %s", err.Error())
72+
}
73+
74+
if !processState.Success() {
75+
os.Exit(processState.ExitCode())
6776
}
6877
}
6978

0 commit comments

Comments
 (0)