Skip to content
Myr

Do not proceed if $TERM is invalid

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Related #305

authored by Junegunn Choi · committed by Junegunn Choi · parent dce6fe6 · Browse files · 2 files+10 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+10 added−0 removed

  • tests:+5 added−0 removed
  • other:+5 added−0 removed

2 files+10 added−0 removed

modified:src/curses/curses.go+5 added
6 unmodified lines
7*/8import "C"910import (11 "fmt"12 "os"13 "os/signal"14 "syscall"15 "time"
242 unmodified lines
258 }259260 C.setlocale(C.LC_ALL, C.CString(""))261 _screen = C.newterm(nil, C.stderr, C.stdin)262 if _screen == nil {263 fmt.Println("Invalid $TERM: " + os.Getenv("TERM"))264 os.Exit(1)265 }266 C.set_term(_screen)267 if mouse {268 C.mousemask(C.ALL_MOUSE_EVENTS, nil)269 }
287 unmodified lines
modified:test/test_go.rb+5 added
741 unmodified lines
742 tmux.until { |lines| lines[1 + 7] == ' 1000/1000' }743 tmux.send_keys :Enter744 end745746 def test_invalid_term747 tmux.send_keys "TERM=xxx fzf", :Enter748 tmux.until { |lines| lines.any? { |l| l.include? 'Invalid $TERM: xxx' } }749 end750751private752 def writelines path, lines753 File.unlink path while File.exists? path754 File.open(path, 'w') { |f| f << lines.join($/) }
237 unmodified lines