mirror of
https://github.com/jesseduffield/lazygit.git
synced 2024-12-04 10:34:55 +02:00
975d2bedb6
From the go 1.19 release notes: Command and LookPath no longer allow results from a PATH search to be found relative to the current directory. This removes a common source of security problems but may also break existing programs that depend on using, say, exec.Command("prog") to run a binary named prog (or, on Windows, prog.exe) in the current directory. See the os/exec package documentation for information about how best to update such programs.
32 lines
498 B
Go
32 lines
498 B
Go
//go:build !windows
|
|
// +build !windows
|
|
|
|
package tail
|
|
|
|
import (
|
|
"log"
|
|
"os"
|
|
"os/exec"
|
|
|
|
"github.com/aybabtme/humanlog"
|
|
)
|
|
|
|
func tailLogsForPlatform(logFilePath string, opts *humanlog.HandlerOptions) {
|
|
cmd := exec.Command("tail", "-f", logFilePath)
|
|
|
|
stdout, _ := cmd.StdoutPipe()
|
|
if err := cmd.Start(); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
if err := humanlog.Scanner(stdout, os.Stdout, opts); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
if err := cmd.Wait(); err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
|
|
os.Exit(0)
|
|
}
|