Skip to content

Commit

Permalink
ignore select-layout and select-pane error, they are not critical
Browse files Browse the repository at this point in the history
  • Loading branch information
fzerorubigd committed Nov 8, 2014
1 parent f720f67 commit 40b8240
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ for better usage help, use ```tmass help```
## Known issue
- In saving session, the saved command are always without the parameters part. for example `ls -al` is `ls`, this is a tmux limitation
- The window name in most configs are ignored
- If the pane count are more than tmux limit, then tmass try to create new window instead of split-window. In this case there is some problem with layout selection.

## Config file

Expand Down
10 changes: 5 additions & 5 deletions tmux/tmux.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (m *Command) String() string {

func (m *Command) Execute(base string, args []string) (string, error) {
args = append(args, m.Parts...)
out, err := exec.Command(base, args...).Output()
out, err := exec.Command(base, args...).CombinedOutput()

if err != nil {
err = fmt.Errorf("failed to execute %s %s : %s \n %s", base, strings.Join(args, " "), err.Error(), string(out))
Expand Down Expand Up @@ -129,12 +129,12 @@ func BuildSession(s *Session, tmux string, args []string, rename bool) error {
// The problem is, layout may contain the focus. so for setting focus, we need to call it after setting layout
c := Command{[]string{"select-layout", s.Windows[i].Layout}}
if _, err := c.Execute(tmux, args); err != nil {
return err
log.Println(colorstring.Color("[yellow] Failed to apply layout. ignored"))
}

if cf != nil {
if _, err := cf.Execute(tmux, args); err != nil {
return err
log.Println(colorstring.Color("[yellow] Failed to select pane. ignored"))
}
}
}
Expand All @@ -148,8 +148,8 @@ func newWindowFallback(w *Window, tmux string, args []string, s *Session, p *Pan
log.Println(colorstring.Color("[yellow] Failed to split window. try to create new window."))
// First try to set layout for old window
c := Command{[]string{"select-layout", w.Layout}}
if n, err := c.Execute(tmux, args); err != nil {
return n, err
if _, err := c.Execute(tmux, args); err != nil {
log.Println(colorstring.Color("[yellow] Failed to apply layout. ignored"))
}
c.Clear()
c.Add("new-window", "-P", "-t", s.Name, "-n", w.Name, "-c", p.Root)
Expand Down

0 comments on commit 40b8240

Please sign in to comment.