-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: (windows) wireguard command permission elevation
- Loading branch information
1 parent
4504d1b
commit db8b196
Showing
9 changed files
with
164 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.idea | ||
.sandbox | ||
include/ | ||
.sandbox/ | ||
.tool-versions | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package cmdRunner | ||
|
||
import ( | ||
"context" | ||
"os/exec" | ||
) | ||
|
||
type Func func(ctx context.Context) error | ||
|
||
func CommandContext(ctx context.Context, cmd string, args ...string) *ExecCmd { | ||
return &ExecCmd{ | ||
Cmd: exec.CommandContext(ctx, cmd, args...), | ||
ctx: ctx, | ||
} | ||
} | ||
|
||
type ExecCmd struct { | ||
*exec.Cmd | ||
ctx context.Context | ||
Check failure on line 19 in src/cmdRunner/execCmd.go GitHub Actions / Build && tests for linux amd64
Check failure on line 19 in src/cmdRunner/execCmd.go GitHub Actions / Build && tests for linux 386
|
||
before Func | ||
after Func | ||
} | ||
|
||
func (e *ExecCmd) SetBefore(f Func) *ExecCmd { | ||
e.before = f | ||
return e | ||
} | ||
|
||
func (e *ExecCmd) execBefore() error { | ||
if e.before == nil { | ||
return nil | ||
} | ||
return e.before(e.ctx) | ||
} | ||
|
||
func (e *ExecCmd) SetAfter(f Func) *ExecCmd { | ||
e.after = f | ||
return e | ||
} | ||
|
||
func (e *ExecCmd) execAfter() error { | ||
if e.after == nil { | ||
return nil | ||
} | ||
return e.after(e.ctx) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters