Reputation: 2572
I have a gulp task that's hanging after completion.
Running --verbose
on my command tells me that it completed the run, but it doesnt exit the process
// ./gulpfile.js/precon/index.js
const { preconMoveFile, preconExcelToMysql } = require('../../src/lib/preCon')
module.exports = async done => {
try {
await preconMoveFile()
await preconExcelToMysql()
done()
// return <-- doesnt work either per comment
} catch (e) {
throw e
}
}
below is the command line output, pardon my debug log output
C:\Users\ALilland\Documents\macros\experiments\forecast-scraper>set NODE_ENV=development& gulp precon --verbose
[12:33:57] Using gulpfile ~\Documents\macros\experiments\forecast-scraper\gulpfile.js
[12:33:57] Starting 'precon'...
[2019-07-30T19:33:57.264Z] DEBUG - [preCon.preconMoveFile] existing ./src/tmp/precon.xlsx removed
[2019-07-30T19:33:57.333Z] DEBUG - [preCon.preconMoveFile] copied new file to ./src/tmp/precon.xlsx
[2019-07-30T19:33:58.965Z] INFO - [initialize.db.caePreconForecast] created caePreconForecast
[2019-07-30T19:33:59.012Z] DEBUG - [preCon.preconExcelToMysql] added rows to db
[12:34:00] Finished 'precon' after 3.24 s
I tried several of the options shown in the docs with no success, and also tried several of the options here with no success
I have also tried calling process.exit(0)
but that produces the Did you forget to signal async completion?
warning that the docs mention
Edit:
I should also note my root index.js file that requires the precon
task
// ./gulpfile.js/index.js
exports.default = require('./default')
exports.precon = require('./precon')
Upvotes: 0
Views: 248
Reputation: 2572
The hang does not result from gulp, there is a background process still running preventing gulp from closing
the culprit was an open mysql pool connection
const mysql = require('mysql')
const params = require('../config/mysql')
const db = mysql.createPool(params)
db.end() // <-- running this after each task resolves the issue
Upvotes: 1