Skip to content
Myr

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

3 files+34 added−22 removed

modified:src/tui/tcell.go+4 added
1 unmodified line
23package tui45import (6 "os"7 "time"8 "unicode/utf8"910 "runtime"
129 unmodified lines
140 _screen = s141}142143func (r *FullscreenRenderer) Init() {144 if os.Getenv("TERM") == "cygwin" {145 os.Setenv("TERM", "")146 }147 encoding.Register()148149 r.initScreen()150 initTheme(r.theme, r.defaultTheme(), r.forceBlack)
428 unmodified lines
modified:src/util/util_windows.go+1 added-5 removed
10 unmodified lines
11)1213// ExecCommand executes the given command with $SHELL14func 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}2122// IsWindows returns true on Windows23func IsWindows() bool {
12 unmodified lines
modified:install+29 added-17 removed
97 unmodified lines
98 return 199}100101try_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}110111try_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}120121download() {122 echo "Downloading bin/fzf ..."
11 unmodified lines
134 fi135136 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 lines
157archi=$(uname -sm)158binary_available=1159binary_error=""160case "$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 ;;175esac176177cd "$fzf_base"
175 unmodified lines
353 echo 'Use uninstall script to remove fzf.'354 echo355fi356echo 'For more information, see: https://github.com/junegunn/fzf'344