Skip to content

Commit

Permalink
cmd/vinegar: handle flatpak in sysinfo & extreme wine failure cases
Browse files Browse the repository at this point in the history
  • Loading branch information
apprehensions committed Oct 24, 2023
1 parent c4d4385 commit 8b061c5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
16 changes: 13 additions & 3 deletions cmd/vinegar/binary.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,14 @@ func (b *Binary) Run(args ...string) error {
signal.Notify(c, os.Interrupt, syscall.SIGTERM)
go func() {
<-c
log.Println("Killing Roblox")
// This way, cmd.Run() will return and the wineprefix killer will be ran.
cmd.Process.Kill()

// Only kill the process if it even had a PID
if cmd.Process != nil {
log.Println("Killing Roblox")
// This way, cmd.Run() will return and the wineprefix killer will be ran.
cmd.Process.Kill()
}

// Don't handle INT after it was recieved, this way if another signal was sent,
// Vinegar will immediately exit.
signal.Stop(c)
Expand All @@ -118,6 +123,11 @@ func (b *Binary) Run(args ...string) error {
b.Splash.Message("Launching " + b.Alias)

defer func() {
// Don't do anything if the process even ran correctly.
if cmd.Process == nil {
return
}

for {
time.Sleep(100 * time.Millisecond)

Expand Down
6 changes: 4 additions & 2 deletions cmd/vinegar/vinegar.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,8 +198,10 @@ func Sysinfo(pfx *wine.Prefix) {
* Processor: %s
* Supports AVX: %t
* Kernel: %s
* Wine: %s
`
* Wine: %s`

fmt.Printf(info, sysinfo.Distro, sysinfo.CPU, sysinfo.HasAVX, sysinfo.Kernel, ver)
if sysinfo.InFlatpak {
fmt.Println("* Flatpak: [x]")
}
}

0 comments on commit 8b061c5

Please sign in to comment.