Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an overlay for non 0 exit codes. #352

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion app/assets/js/processbuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const { Type } = require('helios-distribution-types')
const os = require('os')
const path = require('path')

const ConfigManager = require('./configmanager')
const ConfigManager = require('./configmanager')

const logger = LoggerUtil.getLogger('ProcessBuilder')

Expand Down Expand Up @@ -94,6 +94,21 @@ class ProcessBuilder {
})
child.on('close', (code, signal) => {
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) => {
if(err){
logger.warn('Error while deleting temp dir', err)
Expand Down
16 changes: 10 additions & 6 deletions app/assets/js/scripts/uicore.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@
* modules, excluding dependencies.
*/
// Requirements
const $ = require('jquery')
const {ipcRenderer, shell, webFrame} = require('electron')
const remote = require('@electron/remote')
const isDev = require('./assets/js/isdev')
const { LoggerUtil } = require('helios-core')
const Lang = require('./assets/js/langloader')
const $ = require('jquery')
const {ipcRenderer, shell, webFrame, clipboard} = require('electron')
const remote = require('@electron/remote')
const isDev = require('./assets/js/isdev')
const { LoggerUtil } = require('helios-core')
const Lang = require('./assets/js/langloader')

const loggerUICore = LoggerUtil.getLogger('UICore')
const loggerAutoUpdater = LoggerUtil.getLogger('AutoUpdater')

function copy(value) {
clipboard.writeText(value, 'selection')
}

// Log deprecation and process warnings.
process.traceProcessWarnings = true
process.traceDeprecation = true
Expand Down
6 changes: 6 additions & 0 deletions app/assets/lang/en_US.toml

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a typo here, the exited code should be the exit code

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

woops I forgot to post this message

Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,12 @@ joined = "Exploring the Realm!"
[js.overlay]
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]
executables = "Executables"
allFiles = "All Files"
Expand Down