Skip to content

Commit

Permalink
context cancel
Browse files Browse the repository at this point in the history
  • Loading branch information
Distortions81 committed Jan 18, 2025
1 parent c09f758 commit 84d6373
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion support/factLauncher.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,9 +477,14 @@ func launchFactorio() {
glob.BootMessage = disc.SmartEditDiscordEmbed(cfg.Local.Channel.ChatChannel, glob.BootMessage, "Status", "Loading mods...", glob.COLOR_GREEN)
}

if glob.FactorioCancel != nil {
cwlog.DoLogCW("Canceling existing context.")
glob.FactorioCancel()
}
if glob.FactorioCmd != nil {
if isProcessRunning(glob.FactorioCmd) || isProcessAlive(glob.FactorioCmd.Process.Pid) {
cwlog.DoLogCW("Previous Factorio process appears to be hard locked, killing process.")
cwlog.DoLogCW("Killing Previous Factorio process.")

glob.FactorioCmd.Process.Kill()
glob.FactorioCmd.Wait()
}
Expand Down

0 comments on commit 84d6373

Please sign in to comment.