mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-09-10 06:50:54 +00:00
✨ Watch scripts inside tap
command
This commit is contained in:
@@ -51,10 +51,14 @@ func runScripts() {
|
||||
runProxy(false)
|
||||
}
|
||||
|
||||
files := make(map[string]int64)
|
||||
|
||||
connector = connect.NewConnector(kubernetes.GetLocalhostOnPort(config.Config.Tap.Proxy.Hub.SrcPort), connect.DefaultRetries, connect.DefaultTimeout)
|
||||
|
||||
watchScripts(true)
|
||||
}
|
||||
|
||||
func watchScripts(block bool) {
|
||||
files := make(map[string]int64)
|
||||
|
||||
scripts, err := config.Config.Scripting.GetScripts()
|
||||
if err != nil {
|
||||
log.Error().Err(err).Send()
|
||||
@@ -76,7 +80,9 @@ func runScripts() {
|
||||
log.Error().Err(err).Send()
|
||||
return
|
||||
}
|
||||
defer watcher.Close()
|
||||
if block {
|
||||
defer watcher.Close()
|
||||
}
|
||||
|
||||
go func() {
|
||||
for {
|
||||
@@ -138,7 +144,9 @@ func runScripts() {
|
||||
|
||||
log.Info().Str("directory", config.Config.Scripting.Source).Msg("Watching files against changes:")
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
utils.WaitForTermination(ctx, cancel)
|
||||
if block {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
defer cancel()
|
||||
utils.WaitForTermination(ctx, cancel)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user