1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-28 16:02:01 +03:00

fix merge conflict cat issue on windows

This commit is contained in:
Jesse Duffield
2021-04-02 12:55:50 +11:00
parent 8b7f7cbc30
commit 8901d11674
4 changed files with 16 additions and 4 deletions

View File

@ -24,7 +24,7 @@ import (
// Platform stores the os state
type Platform struct {
OS string
CatCmd string
CatCmd []string
Shell string
ShellArg string
EscapedQuote string
@ -100,6 +100,18 @@ func (c *OSCommand) RunCommandWithOutput(formatString string, formatArgs ...inte
return output, err
}
func (c *OSCommand) CatFile(filename string) (string, error) {
arr := append(c.Platform.CatCmd, filename)
cmdStr := strings.Join(arr, " ")
c.Log.WithField("command", cmdStr).Info("Cat")
cmd := c.Command(arr[0], arr[1:]...)
output, err := sanitisedCommandOutput(cmd.CombinedOutput())
if err != nil {
c.Log.WithField("command", cmdStr).Error(err)
}
return output, err
}
// RunExecutableWithOutput runs an executable file and returns its output
func (c *OSCommand) RunExecutableWithOutput(cmd *exec.Cmd) (string, error) {
c.BeforeExecuteCmd(cmd)