File: exec_windows.go

package info (click to toggle)
gdu 5.34.2-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 1,288 kB
  • sloc: makefile: 145
file content (33 lines) | stat: -rw-r--r-- 532 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package tui

import (
	"os"
)

func getShellBin() string {
	shellbin, ok := os.LookupEnv("COMSPEC")
	if !ok {
		shellbin = "C:\\WINDOWS\\System32\\cmd.exe"
	}
	return shellbin
}

func (ui *UI) spawnShell() {
	if ui.currentDir == nil {
		return
	}

	ui.app.Stop()

	if err := os.Chdir(ui.currentDirPath); err != nil {
		ui.showErr("Error changing directory", err)
		return
	}
	if err := ui.exec(getShellBin(), nil, os.Environ()); err != nil {
		ui.showErr("Error executing shell", err)
	}
}

func stopProcess() error {
	return nil
}