diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f37bb2e..ec29586 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: run: npm ci - name: Run tests - run: npm run test + run: npm run test:ci - name: Move MySQLMSN directory for GitHub Actions upload if: ${{ failure() }} @@ -31,7 +31,7 @@ jobs: MOVE_MYSQLMSN_TO: /tmp/mysqlmsn run: npx ts-node tests/ci/DirMoveGitHubActions.ts - - name: Upload mysqlmsn directory (Not Windows) + - name: Upload mysqlmsn directory if: ${{ failure() }} uses: actions/upload-artifact@v4.3.5 with: diff --git a/.github/workflows/node-compatibility.yml b/.github/workflows/node-compatibility.yml index def22ce..d911823 100644 --- a/.github/workflows/node-compatibility.yml +++ b/.github/workflows/node-compatibility.yml @@ -8,12 +8,17 @@ on: jobs: node: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: + os: [macos-14, macos-15, macos-15-intel, macos-26, ubuntu-22.04, ubuntu-24.04, windows-2022, windows-2025, ubuntu-22.04-arm, ubuntu-24.04-arm, windows-11-arm] node-version: [18.x, 19.x, 20.x, 21.x, 22.x, 23.x, 24.x, 25.x] + # Exclude Node 18.x on Windows on Arm because Node only provides Windows on Arm binaries for Node >= 19 + exclude: + - os: windows-11-arm + node-version: 18.x steps: - name: Checkout @@ -31,10 +36,16 @@ jobs: - name: Run tests run: npm run test:ci + - name: Move MySQLMSN directory for GitHub Actions upload + if: ${{ failure() }} + env: + MOVE_MYSQLMSN_TO: ${{ runner.os == 'Windows' && 'C:\\Users\\RUNNER~1\\mysqlmsn' || '/tmp/mysqlmsn' }} + run: npx ts-node tests/ci/DirMoveGitHubActions.ts + - name: Upload mysqlmsn directory if: ${{ failure() }} uses: actions/upload-artifact@v4.3.5 with: name: node-${{ matrix.node-version }} - path: /tmp/mysqlmsn + path: ${{ runner.os == 'Windows' && 'C:\\Users\\RUNNER~1\\mysqlmsn' || '/tmp/mysqlmsn' }} compression-level: 9 \ No newline at end of file diff --git a/.github/workflows/old-node-tests.yml b/.github/workflows/old-node-tests.yml index 1170d56..e945aab 100644 --- a/.github/workflows/old-node-tests.yml +++ b/.github/workflows/old-node-tests.yml @@ -8,12 +8,14 @@ on: jobs: node: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: node-version: [16.6.0, 16.x, 17.0.0, 17.x] + # windows-11-arm is not included here because Node only has Windows on Arm binaries for Node >= 19 + os: [macos-14, macos-15, macos-15-intel, macos-26, ubuntu-22.04, ubuntu-24.04, windows-2022, windows-2025, ubuntu-22.04-arm, ubuntu-24.04-arm] steps: - name: Checkout @@ -31,10 +33,16 @@ jobs: - name: Run tests run: npx ts-node tests/old-node.ts + - name: Move MySQLMSN directory for GitHub Actions upload + if: ${{ failure() }} + env: + MOVE_MYSQLMSN_TO: ${{ runner.os == 'Windows' && 'C:\\Users\\RUNNER~1\\mysqlmsn' || '/tmp/mysqlmsn' }} + run: npx ts-node tests/ci/DirMoveGitHubActions.ts + - name: Upload mysqlmsn directory if: ${{ failure() }} uses: actions/upload-artifact@v4.3.5 with: name: node-${{ matrix.node-version }} - path: /tmp/mysqlmsn + path: ${{ runner.os == 'Windows' && 'C:\\Users\\RUNNER~1\\mysqlmsn' || '/tmp/mysqlmsn' }} compression-level: 9 \ No newline at end of file diff --git a/.github/workflows/os-compatibility.yml b/.github/workflows/os-compatibility.yml index 687c4be..230aba0 100644 --- a/.github/workflows/os-compatibility.yml +++ b/.github/workflows/os-compatibility.yml @@ -41,20 +41,12 @@ jobs: MOVE_MYSQLMSN_TO: ${{ runner.os == 'Windows' && 'C:\\Users\\RUNNER~1\\mysqlmsn' || '/tmp/mysqlmsn' }} run: npx ts-node tests/ci/DirMoveGitHubActions.ts - - name: Upload mysqlmsn directory (Windows) - if: ${{ failure() && runner.os == 'Windows' }} - uses: actions/upload-artifact@v4.3.5 - with: - name: ${{ matrix.os }}-${{ matrix.version-requirement }} - path: "C:\\Users\\RUNNER~1\\mysqlmsn" - compression-level: 9 - - - name: Upload mysqlmsn directory (Not Windows) - if: ${{ failure() && runner.os != 'Windows' }} + - name: Upload mysqlmsn directory + if: ${{ failure() }} uses: actions/upload-artifact@v4.3.5 with: - name: ${{ matrix.os }}-${{ matrix.version-requirement }} - path: /tmp/mysqlmsn + name: node-${{ matrix.node-version }} + path: ${{ runner.os == 'Windows' && 'C:\\Users\\RUNNER~1\\mysqlmsn' || '/tmp/mysqlmsn' }} compression-level: 9 fedora-docker: diff --git a/src/libraries/Executor.ts b/src/libraries/Executor.ts index c3724d2..ad647a4 100644 --- a/src/libraries/Executor.ts +++ b/src/libraries/Executor.ts @@ -35,15 +35,19 @@ class Executor { }) } - async #killProcess(process: ChildProcess): Promise { + async #killProcess(childProcess: ChildProcess): Promise { // If the process has already been killed, return true - if (process.kill(0) === false) { - this.logger.warn('Called #killProcess to kill mysqld but it has already been killed.') + const pid = childProcess.pid + + try { + process.kill(pid, 0) + } catch (e) { + this.logger.warn('#killProcess got called to kill mysqld but it is not running:', e) return true } if (os.platform() === 'win32') { - const {error, stderr} = await this.#executeFile('taskkill', ['/pid', String(process.pid), '/t', '/f']) + const {error, stderr} = await this.#executeFile('taskkill', ['/pid', String(pid), '/t', '/f']) const message = error || stderr if (!message) { @@ -59,7 +63,7 @@ class Executor { return false } - return process.kill('SIGKILL') + return process.kill(pid, 'SIGKILL') } //Returns a path to the binary if it should be deleted