Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix app startup issues after changing the args via UI #635

Merged
merged 6 commits into from
Dec 16, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions pkg/app/appserver/proc.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,13 @@ func (p *Proc) Start() error {
close(waitErrCh)
}()

defer func() {
// here will definitely be an error notifying that the process
// is already stopped. We do this to remove proc from the manager,
// therefore giving the correct app status to hypervisor.
_ = p.m.Stop(p.appName) //nolint:errcheck
}()

select {
case _, ok := <-p.connCh:
if !ok {
Expand All @@ -181,11 +188,6 @@ func (p *Proc) Start() error {
// channel won't get closed outside, close it now.
p.connOnce.Do(func() { close(p.connCh) })

// here will definitely be an error notifying that the process
// is already stopped. We do this to remove proc from the manager,
// therefore giving the correct app status to hypervisor.
_ = p.m.Stop(p.appName) //nolint:errcheck

return
}

Expand Down
4 changes: 2 additions & 2 deletions pkg/app/launcher/launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ func (l *Launcher) startApp(cmd string, args, envs []string) error {
if !ok {
return ErrAppNotFound
}

if args != nil {
ac.Args = args
}
Expand Down Expand Up @@ -260,8 +261,7 @@ func (l *Launcher) RestartApp(name string) error {
}

cmd := proc.Cmd()
// complete list of args includes binary name which is not needed, so omit it
if err := l.StartApp(name, cmd.Args[1:], cmd.Env); err != nil {
if err := l.StartApp(name, nil, cmd.Env); err != nil {
return fmt.Errorf("failed to start %s: %w", name, err)
}

Expand Down