Skip to content

Commit

Permalink
Overwrite launch agent on start
Browse files Browse the repository at this point in the history
  • Loading branch information
kakengloh committed Sep 2, 2022
1 parent f12a7c5 commit fb01069
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions services/reminder/reminder_darwin.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,20 +93,15 @@ func Start() error {
return err
}

// Check if launch agent file exists
_, err = os.Stat(path.Join(launchAgentsDir, launchAgentFileName))
// Create launch agent file
f, err := os.OpenFile(path.Join(launchAgentsDir, launchAgentFileName), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
// Create launch agent file
f, err := os.OpenFile(path.Join(launchAgentsDir, launchAgentFileName), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
return fmt.Errorf("failed to create launch agent: %w", err)
}
defer f.Close()

_, err = f.Write([]byte(payload))
if err != nil {
return fmt.Errorf("failed to create launch agent: %w", err)
}
return fmt.Errorf("failed to create launch agent: %w", err)
}
defer f.Close()
_, err = f.Write([]byte(payload))
if err != nil {
return fmt.Errorf("failed to create launch agent: %w", err)
}

// Start launch agent
Expand Down

0 comments on commit fb01069

Please sign in to comment.