Skip to content

Commit

Permalink
use cmd.exe as default shell on windows
Browse files Browse the repository at this point in the history
Mentioned in #12.
  • Loading branch information
gokcehan committed Aug 2, 2017
1 parent 6631cdb commit eb2710c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
6 changes: 5 additions & 1 deletion app.go
Expand Up @@ -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)
}

args = append([]string{"-c", s, "--"}, args...)
if runtime.GOOS == "windows" {
args = append([]string{"/c", s}, args...)
} else {
args = append([]string{"-c", s, "--"}, args...)
}

cmd := exec.Command(gOpts.shell, args...)

Expand Down
11 changes: 9 additions & 2 deletions opts.go
@@ -1,6 +1,9 @@
package main

import "time"
import (
"runtime"
"time"
)

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

0 comments on commit eb2710c

Please sign in to comment.