This commit is contained in:
Ulysse Gressé-Lugué 2024-11-30 23:29:53 +00:00 committed by GitHub
commit 393a8c8f4f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 32 additions and 7 deletions

View File

@ -8,7 +8,7 @@ const { Type } = require('helios-distribution-types')
const os = require('os') const os = require('os')
const path = require('path') const path = require('path')
const ConfigManager = require('./configmanager') const ConfigManager = require('./configmanager')
const logger = LoggerUtil.getLogger('ProcessBuilder') const logger = LoggerUtil.getLogger('ProcessBuilder')
@ -94,6 +94,21 @@ class ProcessBuilder {
}) })
child.on('close', (code, signal) => { child.on('close', (code, signal) => {
logger.info('Exited with code', code) logger.info('Exited with code', code)
if(code != 0){
setOverlayContent(
Lang.queryJS('processbuilder.exit.exitErrorHeader'),
Lang.queryJS('processbuilder.exit.message') + code,
Lang.queryJS('processbuilder.exit.copyCode')
)
setOverlayHandler(() => {
copy(Lang.queryJS('processbuilder.exit.copyCodeText') + code)
toggleOverlay(false)
})
setDismissHandler(() => {
toggleOverlay(false)
})
toggleOverlay(true, true)
}
fs.remove(tempNativePath, (err) => { fs.remove(tempNativePath, (err) => {
if(err){ if(err){
logger.warn('Error while deleting temp dir', err) logger.warn('Error while deleting temp dir', err)

View File

@ -5,16 +5,20 @@
* modules, excluding dependencies. * modules, excluding dependencies.
*/ */
// Requirements // Requirements
const $ = require('jquery') const $ = require('jquery')
const {ipcRenderer, shell, webFrame} = require('electron') const {ipcRenderer, shell, webFrame, clipboard} = require('electron')
const remote = require('@electron/remote') const remote = require('@electron/remote')
const isDev = require('./assets/js/isdev') const isDev = require('./assets/js/isdev')
const { LoggerUtil } = require('helios-core') const { LoggerUtil } = require('helios-core')
const Lang = require('./assets/js/langloader') const Lang = require('./assets/js/langloader')
const loggerUICore = LoggerUtil.getLogger('UICore') const loggerUICore = LoggerUtil.getLogger('UICore')
const loggerAutoUpdater = LoggerUtil.getLogger('AutoUpdater') const loggerAutoUpdater = LoggerUtil.getLogger('AutoUpdater')
function copy(value) {
clipboard.writeText(value, 'selection')
}
// Log deprecation and process warnings. // Log deprecation and process warnings.
process.traceProcessWarnings = true process.traceProcessWarnings = true
process.traceDeprecation = true process.traceDeprecation = true

View File

@ -218,6 +218,12 @@ joined = "Exploring the Realm!"
[js.overlay] [js.overlay]
dismiss = "Dismiss" dismiss = "Dismiss"
[js.processbuilder.exit]
exitErrorHeader = "Game exited with an error code"
message = "The game exited abnormally with the exited code: "
copyCode = "Copy exit code"
copyCodeText = "Minecraft exit code "
[js.settings.fileSelectors] [js.settings.fileSelectors]
executables = "Executables" executables = "Executables"
allFiles = "All Files" allFiles = "All Files"