Skip to content

Commit

Permalink
fix: sudo prompt icon on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
CyanSalt committed Apr 13, 2021
1 parent bb15fbd commit c1f9a0b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions main/utils/privilige.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
import * as path from 'path'
import { app } from 'electron'
import * as sudo from 'sudo-prompt'
import { resources } from '../utils/directory'

const sudoExeca = (command: string) => {
return new Promise((resolve, reject) => {
sudo.exec(command, {
name: app.name,
icns: resources.file('images/icon.icns'),
icns: process.platform === 'darwin'
? path.join(app.getPath('exe'), '../../Resources/electron.icns')
: undefined,
}, (err, stdout, stderr) => {
if (err) reject(Object.assign(err, { stdout, stderr }))
else resolve({ stdout, stderr })
Expand Down

0 comments on commit c1f9a0b

Please sign in to comment.