diff options
author | 2021-11-27 15:26:58 +0100 | |
---|---|---|
committer | 2021-11-27 15:26:58 +0100 | |
commit | 182b4eea73881c611a0f519576aa6ad2aa6799c2 (patch) | |
tree | 230fac469690fcee8797b13585e739be148d4789 /vendor/modernc.org/ccgo/v3/lib/util.go | |
parent | Require confirmed email when checking oauth token (#332) (diff) | |
download | gotosocial-182b4eea73881c611a0f519576aa6ad2aa6799c2.tar.xz |
Update dependencies (#333)
Diffstat (limited to 'vendor/modernc.org/ccgo/v3/lib/util.go')
-rw-r--r-- | vendor/modernc.org/ccgo/v3/lib/util.go | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/vendor/modernc.org/ccgo/v3/lib/util.go b/vendor/modernc.org/ccgo/v3/lib/util.go index aeef2055f..f11e439ca 100644 --- a/vendor/modernc.org/ccgo/v3/lib/util.go +++ b/vendor/modernc.org/ccgo/v3/lib/util.go @@ -375,7 +375,7 @@ func Shell(cmd string, args ...string) ([]byte, error) { func MustShell(stackTrace bool, cmd string, args ...string) []byte { b, err := Shell(cmd, args...) if err != nil { - Fatalf(stackTrace, "%s\n%s", b, err) + Fatalf(stackTrace, "%v %s\noutput: %s\nerr: %s", cmd, args, b, err) } return b @@ -389,6 +389,26 @@ func MustCompile(stackTrace bool, args ...string) []byte { return MustShell(stackTrace, "ccgo", args...) } +// Run is like Compile, but executes in-process. +func Run(args ...string) ([]byte, error) { + var b bytes.Buffer + t := NewTask(append([]string{"ccgo"}, args...), &b, &b) + err := t.Main() + return b.Bytes(), err +} + +// MustRun is like Run but if executes Fatal(stackTrace, err) if it fails. +func MustRun(stackTrace bool, args ...string) []byte { + var b bytes.Buffer + args = append([]string{"ccgo"}, args...) + t := NewTask(args, &b, &b) + if err := t.Main(); err != nil { + Fatalf(stackTrace, "%v\noutput: %s\nerr: %s", args, b.Bytes(), err) + } + + return b.Bytes() +} + // AbsCwd returns the absolute working directory. func AbsCwd() (string, error) { wd, err := os.Getwd() |