Skip to content

Commit 5ea4792

Browse files
set xPort to -1 and xSocket to empty string when X fails to start successfully
1 parent a590459 commit 5ea4792

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

src/libraries/Executor.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,17 @@ class Executor {
222222

223223
const xStartedSuccessfully = file.includes('X Plugin ready for connections')
224224

225+
if (options.xEnabled === 'FORCE' && !xStartedSuccessfully) {
226+
this.logger.error('Error file:', file)
227+
this.logger.error('MySQL X failed to start successfully and xEnabled is set to "FORCE". Error log is above this message. If this is happening continually and you can start the database without the X Plugin, you can set options.xEnabled to "ON" or "OFF" instead of "FORCE".')
228+
return reject('X Plugin failed to start and options.xEnabled is set to "FORCE".')
229+
}
225230

226-
resolve({
231+
const result: MySQLDB = {
227232
port,
228-
xPort: xStartedSuccessfully ? mySQLXPort : undefined,
233+
xPort: xStartedSuccessfully ? mySQLXPort : -1,
229234
socket,
230-
xSocket: xStartedSuccessfully ? xSocket : undefined,
235+
xSocket: xStartedSuccessfully ? xSocket : '',
231236
dbName: options.dbName,
232237
username: options.username,
233238
mysql: {
@@ -248,7 +253,9 @@ class Executor {
248253
}
249254
})
250255
}
251-
})
256+
}
257+
258+
resolve(result)
252259
}
253260
}
254261
})

types/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ export type ExecuteFileReturn = {
4848

4949
export type MySQLDB = {
5050
port: number,
51-
xPort: number | undefined,
51+
xPort: number,
5252
socket: string,
53-
xSocket: string | undefined,
53+
xSocket: string,
5454
dbName: string,
5555
username: string,
5656
mysql: {

0 commit comments

Comments
 (0)