Adds comments and alternate case for errors
This commit is contained in:
parent
fea430485f
commit
450e73f76c
|
@ -100,12 +100,18 @@ func Visit(addr, openhttp string) (View, error) {
|
|||
return View{}, fmt.Errorf("")
|
||||
}
|
||||
} else if u.Gophertype == "8" || u.Gophertype == "T" {
|
||||
// Case for telnet links
|
||||
c := exec.Command("telnet", u.Host, u.Port)
|
||||
c.Stdin = os.Stdin
|
||||
c.Stdout = os.Stdout
|
||||
c.Stderr = os.Stderr
|
||||
// Clear the screen and position the cursor at the top left
|
||||
fmt.Print("\033[2J\033[0;0H")
|
||||
c.Run()
|
||||
err := c.Run()
|
||||
if err != nil {
|
||||
return View{}, fmt.Errorf("Telnet connection error")
|
||||
}
|
||||
|
||||
return View{}, fmt.Errorf("Telnet session terminated")
|
||||
}
|
||||
|
||||
|
|
4
main.go
4
main.go
|
@ -164,7 +164,7 @@ func goToURL(u string) error {
|
|||
v, err := gopher.Visit(u, options["openhttp"])
|
||||
if err != nil {
|
||||
quickMessage("Loading...", true)
|
||||
if err.Error() == "Telnet session terminated" {
|
||||
if err.Error() == "Telnet session terminated" || err.Error() == "Telnet connection error" {
|
||||
screen.ReflashScreen(true)
|
||||
}
|
||||
return err
|
||||
|
@ -197,7 +197,7 @@ func goToLink(l string) error {
|
|||
v, err := gopher.Visit(linkurl, options["openhttp"])
|
||||
if err != nil {
|
||||
quickMessage("Loading...", true)
|
||||
if err.Error() == "Telnet session terminated" {
|
||||
if err.Error() == "Telnet session terminated" || err.Error() == "Telnet connection error" {
|
||||
screen.ReflashScreen(true)
|
||||
}
|
||||
return err
|
||||
|
|
Loading…
Reference in New Issue