Merge pull request #9991 from electron/surface-runas-require-errors

Surface require errors via answer IPC message
This commit is contained in:
Kevin Sawicki 2017-07-13 08:55:06 -07:00 committed by GitHub
commit 1d32f300f3

View file

@ -2,8 +2,21 @@
<body>
<script type="text/javascript" charset="utf-8">
const {ipcRenderer} = require('electron')
const runas = require('runas')
ipcRenderer.send('answer', typeof 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>