Merge pull request #9991 from electron/surface-runas-require-errors
Surface require errors via answer IPC message
This commit is contained in:
commit
1d32f300f3
1 changed files with 15 additions and 2 deletions
|
@ -2,8 +2,21 @@
|
|||
<body>
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
const {ipcRenderer} = require('electron')
|
||||
const runas = require('runas')
|
||||
|
||||
let runas
|
||||
let requireError
|
||||
|
||||
try {
|
||||
runas = require('runas')
|
||||
} catch (error) {
|
||||
requireError = error
|
||||
}
|
||||
|
||||
if (requireError != null) {
|
||||
ipcRenderer.send('answer', `Require runas failed: ${requireError.message}`)
|
||||
} else {
|
||||
ipcRenderer.send('answer', typeof runas)
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue