Skip to content

Commit bf67035

Browse files
remove reject on force and X not starting successfully
1 parent 34fffbc commit bf67035

File tree

3 files changed

+6
-20
lines changed

3 files changed

+6
-20
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ The name of the user to use to login to the database
8787
If on Windows, this is the name of the named pipe that MySQL is listening on. If not on Windows, this is the path to the socket that MySQL is listening on.
8888
- `xSocket: string`
8989
If on Windows, this is the name of the named pipe that the MySQL X Plugin is listening on. If not on Windows, this is the path that the MySQL X Plugin is listening on. If ```options.xEnabled``` is set to "OFF", this value will be an empty string.
90-
- `mysql: {version: string, versionIsInstalledOnSystem: boolean, xPluginIsEnabled: boolean}`
91-
An object with three properties. ```version``` is the version of MySQL used to create the database. ```versionIsInstalledOnSystem``` will be true if the MySQL version used is already installed on the system and false if the version had to be downloaded from MySQL's CDN. ```xPluginIsEnabled``` will be true if ```options.xEnabled``` is set to "FORCE", and will be false if ```options.xEnabled``` is set to "OFF".
90+
- `mysql: {version: string, versionIsInstalledOnSystem: boolean}`
91+
An object with three properties. ```version``` is the version of MySQL used to create the database. ```versionIsInstalledOnSystem``` will be true if the MySQL version used is already installed on the system and false if the version had to be downloaded from MySQL's CDN.
9292
- `stop: () => Promise<void>`
9393
The method to stop the database. The returned promise resolves when the database has successfully stopped.
9494

src/libraries/Executor.ts

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -229,29 +229,16 @@ class Executor {
229229
return //Promise rejection will be handled in the process.on('close') section because this.killedFromPortIssue is being set to true
230230
}
231231

232-
const xStartedSuccessfully = file.includes('X Plugin ready for connections') || file.includes("mysqlx reported: 'Server starts handling incoming connections'") || (lte(this.version, '8.0.12') && gte(this.version, '8.0.4') && file.search(/\[ERROR\].*Plugin mysqlx reported/m) === -1)
233-
234-
if (options.xEnabled === 'FORCE' && !xStartedSuccessfully) {
235-
this.logger.error('Error file:', file)
236-
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 "OFF" instead of "FORCE".')
237-
const killed = await this.#killProcess(process)
238-
if (!killed) {
239-
this.logger.error('Failed to kill MySQL process after MySQL X failing to initialise.')
240-
}
241-
return reject('X Plugin failed to start and options.xEnabled is set to "FORCE".')
242-
}
243-
244232
const result: MySQLDB = {
245233
port,
246-
xPort: xStartedSuccessfully ? mySQLXPort : -1,
234+
xPort: options.xEnabled === 'FORCE' ? mySQLXPort : -1,
247235
socket,
248-
xSocket: xStartedSuccessfully ? xSocket : '',
236+
xSocket: options.xEnabled === 'FORCE' ? xSocket : '',
249237
dbName: options.dbName,
250238
username: options.username,
251239
mysql: {
252240
version: this.version,
253-
versionIsInstalledOnSystem: this.versionInstalledOnSystem,
254-
xPluginIsEnabled: xStartedSuccessfully
241+
versionIsInstalledOnSystem: this.versionInstalledOnSystem
255242
},
256243
stop: () => {
257244
return new Promise(async (resolve, reject) => {

types/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ export type MySQLDB = {
5555
username: string,
5656
mysql: {
5757
version: string,
58-
versionIsInstalledOnSystem: boolean,
59-
xPluginIsEnabled: boolean
58+
versionIsInstalledOnSystem: boolean
6059
},
6160
stop: () => Promise<void>
6261
}

0 commit comments

Comments
 (0)