Skip to content

Commit 6ce51a4

Browse files
committed
Add dialog on startup errors
1 parent e565969 commit 6ce51a4

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

commandbox.js

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,33 @@ function boxExecute(resource_path, command, commandbox_home) {
4949
var cfml_path = path.join(resource_path, 'cfml');
5050
var cmd = `cd "${cfml_path}" && "${java_path}" -jar "${box_path}" ${properites_data} ${command}`;
5151
console.log(cmd);
52-
execute(cmd, (output) => {
53-
console.log(output)
52+
execute(cmd, (output, failed) => {
53+
console.log(output);
5454
})
5555
});
5656
}
5757

5858
function execute(command, callback) {
5959
exec(command, (error, stdout, stderr) => {
60-
if( error ) callback(error)
61-
if( stderr ) callback(stderr)
62-
if( stdout ) callback(stdout)
60+
if( error ) {
61+
if ( stdout ) {
62+
dialog.showMessageBox({
63+
title: 'Failed to Start CommandBox',
64+
message: 'Failed to Start CommandBox',
65+
detail: stdout.toString()
66+
});
67+
}
68+
callback(error, true);
69+
70+
}
71+
if( stderr ) {
72+
callback(stderr, true);
73+
dialog.showMessageBox({
74+
title: 'Failed to Start CommandBox',
75+
message: 'Failed to Start CommandBox',
76+
detail: stderr.toString()
77+
});
78+
}
79+
if( stdout ) callback(stdout, false)
6380
})
6481
}

0 commit comments

Comments
 (0)