Fixes for Cygwin
Before adoption: this commit came in with the history the project adopted, so no landing records it.
- Update install script to download Windows binary if $TERM == cygwin - Unset TERM if $TERM == cygwin (#933) - Always use cmd.exe instead of $SHELL when running commands
authored by Junegunn Choi · committed by Junegunn Choi · parent f4731c0 · Browse files · 3 files·+34 added−22 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+34 added−22 removed
- other:+34 added−22 removed
Provenance
- Commit
ca0b3b6- Tree
611c006- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
f4731c0
3 files changed+34 added−22 removed
modified:src/tui/tcell.go+4 added
1 unmodified line2 3 package tui4 5 import (6+ "os"7 "time"8 "unicode/utf8"9 10 "runtime"129 unmodified lines140 _screen = s141 }142 143 func (r *FullscreenRenderer) Init() {144+ if os.Getenv("TERM") == "cygwin" {145+ os.Setenv("TERM", "")146+ }147 encoding.Register()148 149 r.initScreen()150 initTheme(r.theme, r.defaultTheme(), r.forceBlack)428 unmodified linesmodified:src/util/util_windows.go+1 added-5 removed
10 unmodified lines11 )12 13 // ExecCommand executes the given command with $SHELL14 func ExecCommand(command string) *exec.Cmd {15- shell := os.Getenv("SHELL")16- if len(shell) == 0 {17- shell = "cmd"18- }15 args, _ := shellwords.Parse(command)16 allArgs := make([]string, len(args)+1)17 allArgs[0] = "/c"18 copy(allArgs[1:], args)23- return exec.Command(shell, allArgs...)19+ return exec.Command("cmd", allArgs...)20 }21 22 // IsWindows returns true on Windows23 func IsWindows() bool {12 unmodified linesmodified:install+29 added-17 removed
97 unmodified lines98 return 199 }100 101 try_curl() {102- command -v curl > /dev/null && curl -fL $1 | tar -xzf -102+ command -v curl > /dev/null &&103+ if [[ $1 =~ tgz$ ]]; then104+ curl -fL $1 | tar -xzf -105+ else106+ local temp=${TMPDIR:-/tmp}/fzf.zip107+ curl -fLo "$temp" $1 && unzip -o "$temp" && rm -f "$temp"108+ fi109 }110 111 try_wget() {106- command -v wget > /dev/null && wget -O - $1 | tar -xzf -112+ command -v wget > /dev/null &&113+ if [[ $1 =~ tgz$ ]]; then114+ wget -O - $1 | tar -xzf -115+ else116+ local temp=${TMPDIR:-/tmp}/fzf.zip117+ wget -O "$temp" $1 && unzip -o "$temp" && rm -f "$temp"118+ fi119 }120 121 download() {122 echo "Downloading bin/fzf ..."11 unmodified lines134 fi135 136 local url137 [[ "$version" =~ alpha ]] &&126- url=https://github.com/junegunn/fzf-bin/releases/download/alpha/${1}.tgz ||127- url=https://github.com/junegunn/fzf-bin/releases/download/$version/${1}.tgz138+ url=https://github.com/junegunn/fzf-bin/releases/download/alpha/${1} ||139+ url=https://github.com/junegunn/fzf-bin/releases/download/$version/${1}140 set -o pipefail141 if ! (try_curl $url || try_wget $url); then142 set +o pipefail143 binary_error="Failed to download with curl and wget"13 unmodified lines157 archi=$(uname -sm)158 binary_available=1159 binary_error=""160 case "$archi" in149- Darwin\ *64) download fzf-$version-darwin_${binary_arch:-amd64} ;;150- Darwin\ *86) download fzf-$version-darwin_${binary_arch:-386} ;;151- Linux\ *64) download fzf-$version-linux_${binary_arch:-amd64} ;;152- Linux\ *86) download fzf-$version-linux_${binary_arch:-386} ;;153- Linux\ armv5*) download fzf-$version-linux_${binary_arch:-arm5} ;;154- Linux\ armv6*) download fzf-$version-linux_${binary_arch:-arm6} ;;155- Linux\ armv7*) download fzf-$version-linux_${binary_arch:-arm7} ;;156- Linux\ armv8*) download fzf-$version-linux_${binary_arch:-arm8} ;;157- FreeBSD\ *64) download fzf-$version-freebsd_${binary_arch:-amd64} ;;158- FreeBSD\ *86) download fzf-$version-freebsd_${binary_arch:-386} ;;159- OpenBSD\ *64) download fzf-$version-openbsd_${binary_arch:-amd64} ;;160- OpenBSD\ *86) download fzf-$version-openbsd_${binary_arch:-386} ;;161+ Darwin\ *64) download fzf-$version-darwin_${binary_arch:-amd64}.tgz ;;162+ Darwin\ *86) download fzf-$version-darwin_${binary_arch:-386}.tgz ;;163+ Linux\ *64) download fzf-$version-linux_${binary_arch:-amd64}.tgz ;;164+ Linux\ *86) download fzf-$version-linux_${binary_arch:-386}.tgz ;;165+ Linux\ armv5*) download fzf-$version-linux_${binary_arch:-arm5}.tgz ;;166+ Linux\ armv6*) download fzf-$version-linux_${binary_arch:-arm6}.tgz ;;167+ Linux\ armv7*) download fzf-$version-linux_${binary_arch:-arm7}.tgz ;;168+ Linux\ armv8*) download fzf-$version-linux_${binary_arch:-arm8}.tgz ;;169+ FreeBSD\ *64) download fzf-$version-freebsd_${binary_arch:-amd64}.tgz ;;170+ FreeBSD\ *86) download fzf-$version-freebsd_${binary_arch:-386}.tgz ;;171+ OpenBSD\ *64) download fzf-$version-openbsd_${binary_arch:-amd64}.tgz ;;172+ OpenBSD\ *86) download fzf-$version-openbsd_${binary_arch:-386}.tgz ;;173+ CYGWIN*\ *64) download fzf-$version-windows_${binary_arch:-amd64}.zip ;;174 *) binary_available=0 binary_error=1 ;;175 esac176 177 cd "$fzf_base"175 unmodified lines353 echo 'Use uninstall script to remove fzf.'354 echo355 fi356 echo 'For more information, see: https://github.com/junegunn/fzf'344-