Skip to content

Commit

Permalink
Prevent multiple instances running in same terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
liamg committed Feb 25, 2020
1 parent 0567d62 commit a9d0acb
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/terminal/terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,13 @@ func (t *Terminal) AddDecorator(d decorators.Decorator) {
t.proxy.AddDecorator(d)
}

func (t *Terminal) Run() {
func (t *Terminal) Run() error {

if os.Getenv("SHOX") != "" {
return fmt.Errorf("shox is already running in this terminal")
}

_ = os.Setenv("SHOX", "1")

t.proxy.Start()
defer t.proxy.Close()
Expand Down

0 comments on commit a9d0acb

Please sign in to comment.