chore: 项目基线(基于 WeKnora 定制版,整理文件忽略规则)
This commit is contained in:
commit
9097ee699d
5769 files changed
+1446466
No files matched your search
@@ -0,0 +1,19 @@
|
||||
package sandbox
|
||||
|
||||
import "context"
|
||||
|
||||
type commandOutputKey struct{}
|
||||
|
||||
// WithCommandOutput observes the command executed with this context. It does
|
||||
// not grant installer privileges or change the final command result.
|
||||
func WithCommandOutput(ctx context.Context, callback func(string, []byte)) context.Context {
|
||||
return context.WithValue(ctx, commandOutputKey{}, callback)
|
||||
}
|
||||
|
||||
func commandOutputCallback(ctx context.Context, explicit func(string, []byte)) func(string, []byte) {
|
||||
if explicit != nil {
|
||||
return explicit
|
||||
}
|
||||
callback, _ := ctx.Value(commandOutputKey{}).(func(string, []byte))
|
||||
return callback
|
||||
}
|
||||
Reference in new issue
Block a user