Merge pull request #1870 from tianon/invoke-entrypoint-fixes

This commit is contained in:
Justin Chadwell 2023-06-08 16:03:24 +01:00 committed by GitHub
commit c30bcade2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -726,6 +726,9 @@ func parseInvokeConfig(invoke string) (cfg invokeConfig, err error) {
cfg.Cmd = append(cfg.Cmd, value) // TODO: support JSON cfg.Cmd = append(cfg.Cmd, value) // TODO: support JSON
case "entrypoint": case "entrypoint":
cfg.Entrypoint = append(cfg.Entrypoint, value) // TODO: support JSON cfg.Entrypoint = append(cfg.Entrypoint, value) // TODO: support JSON
if cfg.Cmd == nil {
cfg.Cmd = []string{}
}
case "env": case "env":
cfg.Env = append(cfg.Env, value) cfg.Env = append(cfg.Env, value)
case "user": case "user":

View File

@ -282,6 +282,7 @@ func (m *monitor) startInvoke(ctx context.Context, pid string, cfg controllerapi
} }
if len(cfg.Entrypoint) == 0 && len(cfg.Cmd) == 0 { if len(cfg.Entrypoint) == 0 && len(cfg.Cmd) == 0 {
cfg.Entrypoint = []string{"sh"} // launch shell by default cfg.Entrypoint = []string{"sh"} // launch shell by default
cfg.Cmd = []string{}
} }
go func() { go func() {
// Start a new invoke // Start a new invoke