run localhost mshell with cwd at HOME, not in current directory

This commit is contained in:
sawka 2022-08-24 02:11:49 -07:00
parent f63a851b1a
commit 09a072f900

View File

@ -391,7 +391,12 @@ func (opts SSHOpts) MakeMShellSingleCmd() (*exec.Cmd, error) {
func (opts SSHOpts) MakeSSHExecCmd(remoteCommand string) *exec.Cmd {
remoteCommand = strings.TrimSpace(remoteCommand)
if opts.SSHHost == "" {
homeDir, _ := os.UserHomeDir() // ignore error
if homeDir == "" {
homeDir = "/"
}
ecmd := exec.Command("bash", "-c", remoteCommand)
ecmd.Dir = homeDir
return ecmd
} else {
var moreSSHOpts []string