1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-06-15 00:15:32 +02:00

Change not to use cat command

This commit is contained in:
Ryooooooga
2021-08-23 22:35:19 +09:00
committed by Jesse Duffield
parent 711bd5a670
commit c3d7de1c18
5 changed files with 6 additions and 39 deletions

View File

@ -24,7 +24,6 @@ import (
// Platform stores the os state
type Platform struct {
OS string
CatCmd []string
Shell string
ShellArg string
EscapedQuote string
@ -217,18 +216,6 @@ func (c *OSCommand) RunCommandWithOutputLive(command string, output func(string)
return RunCommandWithOutputLiveWrapper(c, command, output)
}
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(output)
}
return output, err
}
// DetectUnamePass detect a username / password / passphrase question in a command
// promptUserForCredential is a function that gets executed when this function detect you need to fillin a password or passphrase
// The promptUserForCredential argument will be "username", "password" or "passphrase" and expects the user's password/passphrase or username back