diff --git a/config.go b/config.go index 617d63d..e0cdd51 100644 --- a/config.go +++ b/config.go @@ -330,7 +330,7 @@ func openConsole(prof Profile, profileCount int, terminal, tailFile string) { fmt.Fprintf(script, "trap 'kill $TAIL_PID 2>/dev/null; wait $TAIL_PID 2>/dev/null' INT\n") fmt.Fprintf(script, "wait $TAIL_PID\n") } - fmt.Fprintf(script, "cd ~\n") + fmt.Fprintf(script, "cd %q\n", configDir()) fmt.Fprintf(script, "exec %s -l\n", shell) script.Close() os.Chmod(script.Name(), 0700) @@ -353,6 +353,7 @@ func openConsole(prof Profile, profileCount int, terminal, tailFile string) { fmt.Fprintf(script, "echo.\r\n") fmt.Fprintf(script, "powershell -Command \"Get-Content -Path '%s' -Wait\"\r\n", tailFile) } + fmt.Fprintf(script, "cd /d %q\r\n", configDir()) fmt.Fprintf(script, "cmd /k\r\n") script.Close() cmd = exec.Command("cmd", "/c", "start", "", script.Name()) @@ -372,9 +373,9 @@ func openConsole(prof Profile, profileCount int, terminal, tailFile string) { } var script string if tailFile != "" { - script = fmt.Sprintf("clear; echo '%s'; echo '%s'; tail -n +1 -f %q; exec %s", consoleMsg, tailMsg, tailFile, shell) + script = fmt.Sprintf("cd %q; clear; echo '%s'; echo '%s'; tail -n +1 -f %q; exec %s", configDir(), consoleMsg, tailMsg, tailFile, shell) } else { - script = fmt.Sprintf("clear; echo '%s'; exec %s", consoleMsg, shell) + script = fmt.Sprintf("cd %q; clear; echo '%s'; exec %s", configDir(), consoleMsg, shell) } cmd = exec.Command(term, "-e", shell, "-c", script) cmd.Env = env