use cmd.exe as default shell on windows

Mentioned in #12.
This commit is contained in:
Gokcehan 2017-08-02 20:08:49 +03:00
parent 6631cdb23b
commit eb2710c888
2 changed files with 14 additions and 3 deletions

4
app.go
View File

@ -140,7 +140,11 @@ func (app *app) runShell(s string, args []string, wait bool, async bool) {
s = fmt.Sprintf("IFS='%s'; %s", gOpts.ifs, s) s = fmt.Sprintf("IFS='%s'; %s", gOpts.ifs, s)
} }
if runtime.GOOS == "windows" {
args = append([]string{"/c", s}, args...)
} else {
args = append([]string{"-c", s, "--"}, args...) args = append([]string{"-c", s, "--"}, args...)
}
cmd := exec.Command(gOpts.shell, args...) cmd := exec.Command(gOpts.shell, args...)

View File

@ -1,6 +1,9 @@
package main package main
import "time" import (
"runtime"
"time"
)
var gOpts struct { var gOpts struct {
dircounts bool dircounts bool
@ -40,7 +43,11 @@ func init() {
gOpts.scrolloff = 0 gOpts.scrolloff = 0
gOpts.tabstop = 8 gOpts.tabstop = 8
gOpts.filesep = ":" gOpts.filesep = ":"
if runtime.GOOS == "windows" {
gOpts.shell = "cmd"
} else {
gOpts.shell = "/bin/sh" gOpts.shell = "/bin/sh"
}
gOpts.sortby = "natural" gOpts.sortby = "natural"
gOpts.timefmt = time.ANSIC gOpts.timefmt = time.ANSIC
gOpts.ratios = []int{1, 2, 3} gOpts.ratios = []int{1, 2, 3}