mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-06-23 00:39:13 +02:00
avoid useless allocation
This commit is contained in:
@ -41,8 +41,10 @@ func (c *OSCommand) RunCommandWithOutput(command string) (string, error) {
|
|||||||
c.Log.WithField("command", command).Info("RunCommand")
|
c.Log.WithField("command", command).Info("RunCommand")
|
||||||
splitCmd := str.ToArgv(command)
|
splitCmd := str.ToArgv(command)
|
||||||
c.Log.Info(splitCmd)
|
c.Log.Info(splitCmd)
|
||||||
cmdOut, err := exec.Command(splitCmd[0], splitCmd[1:]...).CombinedOutput()
|
|
||||||
return sanitisedCommandOutput(cmdOut, err)
|
return sanitisedCommandOutput(
|
||||||
|
exec.Command(splitCmd[0], splitCmd[1:]...).CombinedOutput(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
// RunCommand runs a command and just returns the error
|
// RunCommand runs a command and just returns the error
|
||||||
@ -57,10 +59,11 @@ func (c *OSCommand) RunDirectCommand(command string) (string, error) {
|
|||||||
args := str.ToArgv(c.Platform.shellArg + " " + command)
|
args := str.ToArgv(c.Platform.shellArg + " " + command)
|
||||||
c.Log.Info(spew.Sdump(args))
|
c.Log.Info(spew.Sdump(args))
|
||||||
|
|
||||||
cmdOut, err := exec.
|
return sanitisedCommandOutput(
|
||||||
Command(c.Platform.shell, args...).
|
exec.
|
||||||
CombinedOutput()
|
Command(c.Platform.shell, args...).
|
||||||
return sanitisedCommandOutput(cmdOut, err)
|
CombinedOutput(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func sanitisedCommandOutput(output []byte, err error) (string, error) {
|
func sanitisedCommandOutput(output []byte, err error) (string, error) {
|
||||||
|
Reference in New Issue
Block a user