Skip to content

Commit

Permalink
fix go version bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kvii committed Jul 28, 2023
1 parent 6165a61 commit af90883
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/launcher/launcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ type Launcher struct {
managed bool
serviceURL string

launched atomic.Bool
isLaunched int32 // zero means not launched
}

// New returns the default arguments to start browser.
Expand Down Expand Up @@ -383,7 +383,7 @@ func (l *Launcher) MustLaunch() string {
//
// Please note launcher can only be used once.
func (l *Launcher) Launch() (string, error) {
if !l.launched.CompareAndSwap(false, true) {
if l.hasLaunched() {
return "", ErrAlreadyLaunched
}

Expand Down Expand Up @@ -439,6 +439,10 @@ func (l *Launcher) Launch() (string, error) {
return ResolveURL(u)
}

func (l *Launcher) hasLaunched() bool {
return !atomic.CompareAndSwapInt32(&l.isLaunched, 0, 1)
}

func (l *Launcher) setupCmd(cmd *exec.Cmd) {
l.osSetupCmd(cmd)

Expand Down

0 comments on commit af90883

Please sign in to comment.