• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

fyne-io / terminal / 24965187579

26 Apr 2026 07:32PM UTC coverage: 50.564% (-0.2%) from 50.786%
24965187579

push

github

web-flow
FIXES #140 and puts a guaranteed refresh every 100ms. (#148)

4 of 4 new or added lines in 1 file covered. (100.0%)

6 existing lines in 1 file now uncovered.

1031 of 2039 relevant lines covered (50.56%)

1086.45 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

76.32
/term_unix.go
1
//go:build !windows
2
// +build !windows
3

4
package terminal
5

6
import (
7
        "io"
8
        "os"
9
        "os/exec"
10
        "strconv"
11
        "time"
12

13
        "fyne.io/fyne/v2"
14
        "github.com/creack/pty"
15
)
16

17
func (t *Terminal) updatePTYSize() {
28✔
18
        if t.pty == nil { // SSH or other direct connection?
54✔
19
                return
26✔
20
        }
26✔
21
        scale := float32(1.0)
2✔
22
        c := fyne.CurrentApp().Driver().CanvasForObject(t)
2✔
23
        if c != nil {
4✔
24
                scale = c.Scale()
2✔
25
        }
2✔
26
        _ = pty.Setsize(t.pty.(*os.File), &pty.Winsize{
2✔
27
                Rows: uint16(t.config.Rows), Cols: uint16(t.config.Columns),
2✔
28
                X: uint16(t.Size().Width * scale), Y: uint16(t.Size().Height * scale)})
2✔
29
}
30

31
func (t *Terminal) startPTY() (io.WriteCloser, io.Reader, io.Closer, error) {
2✔
32
        shell := os.Getenv("SHELL")
2✔
33
        if shell == "" {
2✔
34
                shell = "bash"
×
35
        }
×
36

37
        env := os.Environ()
2✔
38
        env = append(env, "TERM=xterm-256color")
2✔
39
        c := exec.Command(shell)
2✔
40
        c.Dir = t.startingDir()
2✔
41
        c.Env = env
2✔
42
        t.cmd = c
2✔
43
        t.config.PWD = c.Dir
2✔
44

2✔
45
        go func() {
4✔
46
                for {
4✔
47
                        time.Sleep(time.Millisecond * 250)
2✔
48
                        if time.Since(lastKeyTime).Seconds() > 0.5 {
2✔
49
                                continue
×
50
                        }
UNCOV
51
                        wd, _ := os.Readlink("/proc/" + strconv.Itoa(c.Process.Pid) + "/cwd")
×
UNCOV
52

×
UNCOV
53
                        if wd != t.config.PWD {
×
UNCOV
54
                                t.config.PWD = wd
×
UNCOV
55
                                fyne.Do(t.onConfigure)
×
UNCOV
56
                        }
×
57
                }
58
        }()
59

60
        // Start the command with a pty.
61
        f, err := pty.Start(c)
2✔
62
        return f, f, f, err
2✔
63
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc