Skip to content

Instantly share code, notes, and snippets.

@mattn
Last active November 17, 2017 07:31
Show Gist options
  • Star 12 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattn/000735084394601b225a861af4afd35e to your computer and use it in GitHub Desktop.
Save mattn/000735084394601b225a861af4afd35e to your computer and use it in GitHub Desktop.
Visual Studio Code で msys2 の bash を使う方法

Visual Studio Code で msys2 の bash を使う方法

go で bash-login.go をビルドした後、出来上がった exe を以下の様に指定する。

ビルド方法

go build bash-login.go

設定

"terminal.integrated.shell.windows": "c:\\users\\mattn\\bin\\bash-login.exe"

※ zsh を使いたい人は...うまい事やれ

package main
import (
"fmt"
"os"
"os/exec"
)
func main() {
os.Setenv("CHERE_INVOKING", "1")
os.Setenv("MSYSTEM", "MSYS")
cmd := exec.Command(`c:\msys64\usr\bin\bash.exe`, `--login`, `-i`)
cmd.Stdin = os.Stdin
cmd.Stdout = os.Stdout
cmd.Stderr = os.Stderr
if err := cmd.Run(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment