fix: fixed working dir setting for panes

This commit is contained in:
raj 2023-10-23 01:04:04 +05:30
parent cdeaed61f7
commit 6a4ac440b0
1 changed files with 14 additions and 0 deletions

View File

@ -76,6 +76,13 @@ func CreateTmuxSession(config *projectconfig.Configuration) error {
}
log.Debug("Ran command", "command", selectPaneCmd.String())
// Change the working directory
changeDirCmd := exec.Command("tmux", "send-keys", "-t", paneName, "cd "+config.WorkingDir, "Enter")
if err := changeDirCmd.Run(); err != nil {
return err
}
log.Debug("Ran command", "command", changeDirCmd.String())
// Send commands to the pane
sendCommandsCmd := exec.Command("tmux", "send-keys", "-t", paneName, strings.Join(pane.ShellCommand, " && "), "Enter")
if err := sendCommandsCmd.Run(); err != nil {
@ -184,6 +191,13 @@ func createWindow(config *projectconfig.Configuration, sessionName string, index
}
log.Debug("Ran command", "command", selectPaneCmd.String())
// Change the working directory for the pane
changeDirCmd := exec.Command("tmux", "send-keys", "-t", paneName, "cd "+config.WorkingDir, "Enter")
if err := changeDirCmd.Run(); err != nil {
return err
}
log.Debug("Ran command", "command", changeDirCmd.String())
// Send commands to the pane
sendCommandsCmd := exec.Command("tmux", "send-keys", "-t", paneName, strings.Join(pane.ShellCommand, " && "), "Enter")
if err := sendCommandsCmd.Run(); err != nil {