-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix sigwinch error with build constraints
- Loading branch information
Showing
3 changed files
with
41 additions
and
17 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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package pkg | ||
|
||
import ( | ||
"bytes" | ||
"fmt" | ||
"io" | ||
"os" | ||
"os/exec" | ||
"strings" | ||
|
||
"github.com/pterm/pterm" | ||
) | ||
|
||
func execBashCmdAny(dir string, name string, arg ...string) string { | ||
// Use this if the pty one doesn't work | ||
bash_cmd := exec.Command(name, arg...) | ||
bash_cmd.Dir = dir | ||
pterm.DefaultHeader.WithFullWidth().Println(strings.Join(bash_cmd.Args, " ")) | ||
|
||
var stdoutBuf, stderrBuf bytes.Buffer | ||
bash_cmd.Stdout = io.MultiWriter(os.Stdout, &stdoutBuf) | ||
bash_cmd.Stderr = io.MultiWriter(os.Stderr, &stderrBuf) | ||
err := bash_cmd.Run() | ||
if err != nil { | ||
pterm.Error.Println("Error starting cmd: ", err) | ||
return fmt.Sprint(err) | ||
} | ||
|
||
outStr, errStr := string(stdoutBuf.String()), string(stderrBuf.String()) | ||
return fmt.Sprint(outStr, errStr) | ||
} |
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,7 @@ | ||
//go:build windows | ||
|
||
package pkg | ||
|
||
func ExecBashCmd(runtime_os string, dir string, name string, arg ...string) string { | ||
execBashCmdAny(dir, name, arg...) | ||
} | ||