Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add windows support #50

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- master
- main
paths-ignore:
- 'README.md'
pull_request:
Expand All @@ -12,7 +13,11 @@ on:
- 'README.md'
jobs:
unit:
runs-on: ubuntu-20.04
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-latest]
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -23,8 +28,9 @@ jobs:
with:
go-version: 1.17
- name: Setup Dependencies
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get update -q
sudo apt-get install -qqy libpcsclite-dev
- name: Run tests
run: make test
run: go test ./... -cover
4 changes: 1 addition & 3 deletions strategy/credentials/credentials.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import (
"os/exec"
"path/filepath"
"strings"
"syscall"
"time"

"github.com/aws/aws-sdk-go/aws"
Expand Down Expand Up @@ -115,8 +114,7 @@ func (c *Credentials) Exec(app string, args []string) error {

log.Debug(logExec, cmd, args)

return syscall.Exec(cmd, args, env.ToEnv())

return exec_(cmd, args, env.ToEnv())
}

// IsValid indicates if a loaded credential is (still) valid
Expand Down
9 changes: 9 additions & 0 deletions strategy/credentials/credentials_nonwin.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// +build !windows

package credentials

import "syscall"

func exec_(cmd string, args []string, env []string) error {
return syscall.Exec(cmd, args, env)
}
17 changes: 17 additions & 0 deletions strategy/credentials/credentials_win.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// +build windows

package credentials

import (
"os"
"os/exec"
)

func exec_(cmd string, args []string, env []string) error {
c := exec.Command(cmd, args[1:]...)
c.Env = env
c.Stdin = os.Stdin
c.Stdout = os.Stdout
c.Stderr = os.Stderr
return c.Run()
}