1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-26 05:37:18 +02:00
This commit is contained in:
Jesse Duffield 2021-04-03 20:30:18 +11:00
parent d5a5633771
commit be2bf77bf0
4 changed files with 33 additions and 3 deletions

18
main/main.go Normal file
View File

@ -0,0 +1,18 @@
package main
import (
"fmt"
"os"
"os/exec"
)
func main() {
cmd := exec.Command("lazygit")
cmd.Env = os.Environ()
fmt.Println(cmd.Env)
cmd.Stderr = os.Stderr
cmd.Stdout = os.Stdout
cmd.Stdin = os.Stdin
err := cmd.Run()
fmt.Println(err)
}

View File

@ -315,18 +315,27 @@ func runLazygit(t *testing.T, testPath string, rootDir string, record bool, spee
cmd.Stdin = os.Stdin
cmd.Stderr = os.Stderr
cmd.Env = append(
cmd.Env,
os.Environ(),
fmt.Sprintf("RECORD_EVENTS_TO=%s", replayPath),
"TERM=xterm-256color",
)
} else {
cmd.Stdout = os.Stdout
cmd.Stdin = os.Stdin
cmd.Stderr = os.Stderr
cmd.Env = append(
cmd.Env,
os.Environ(),
fmt.Sprintf("REPLAY_EVENTS_FROM=%s", replayPath),
"TERM=xterm-256color",
)
t.Log(cmd.Env)
}
t.Log("here")
// if we're on CI we'll need to use a PTY. We can work that out by seeing if the 'TERM' env is defined.
if runInPTY() {
t.Log("1")
cmd.Env = append(cmd.Env, "TERM=xterm")
f, err := pty.StartWithSize(cmd, &pty.Winsize{Rows: 100, Cols: 100})
@ -338,6 +347,7 @@ func runLazygit(t *testing.T, testPath string, rootDir string, record bool, spee
_ = f.Close()
} else {
t.Log("2")
err := cmd.Run()
assert.NoError(t, err)
}

View File

@ -25,6 +25,7 @@ func (gui *Gui) timeSinceStart() int64 {
}
func (gui *Gui) replayRecordedEvents() {
gui.Log.Warn("going to replay events")
if os.Getenv("REPLAY_EVENTS_FROM") == "" {
return
}
@ -75,6 +76,7 @@ func (gui *Gui) replayRecordedEvents() {
case <-ticker.C:
timeWaited += 1
if gui.g != nil && timeWaited >= timeToWait {
gui.Log.Warn("replaying event")
gui.g.ReplayedEvents <- *event.Event
break middle
}

View File

@ -319,7 +319,7 @@ func (gui *Gui) getConfirmationView() *gocui.View {
}
func (gui *Gui) getInformationView() *gocui.View {
v, _ := gui.g.View("confirmation")
v, _ := gui.g.View("information")
return v
}