-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Doesn't Work In Gulp 4 #45
Comments
@KITSDominicWhite so the official line would be "Gulp4 has not been released in a final form", but I hate it when people respond like that... so I'll do the best I can to assist. Gulp 4 has a bunch of breaking differences from Gulp 3 one of which is that tasks are supposed to return a promise or implement the 'done parameter callback pattern'. Failure to do so will cause the task to timeout with that warning if it is being held open by anything it invoked internally. An example of the 'done parameter callback pattern' would be: var gulp = require('gulp'),
connect = require('gulp-connect-php');
gulp.task('connect-sync', function(done) {
connect.server({});
// never invoking done should hold this task in a 'running' state
// Gulp4 checks the param count on the supplied function and
// if >= 1 waits indefinitely until a done() call is invoked.
});
gulp.task('default', gulp.series('connect-sync')); Now, if for some reason you need this to hold until you are ready for it to complete... the following should work (Linux/Mac): var gulp = require('gulp'),
connect = require('gulp-connect-php');
gulp.task('connect-sync', function(done) {
console.log(`Invoking gulp-connect-php on PID: ${process.pid}.`);
connect.server({});
// https://nodejs.org/api/process.html#process_signal_events
// NOTE:
// SIGINT might also work, that is sent when you issue CTRL+C
// However there is a chance Gulp reacts to it or hides it internally.
process.once('SIGUSR2', function() {
console.log("Got SIGUSR2, invoking callback.");
connect.closeServer();
done();
});
});
gulp.task('default', gulp.series('connect-sync')); Now if you issue a signal via the command line: kill -SIGUSR2 PID That should tell the task to terminate. (All of this is speculative, but it is what i'd try). |
@KITSDominicWhite any luck? |
Sorry @grmartin I went on holiday for a few days. I have given the first one a try with a few variants of my own, and unfortunately I haven't been able to get it working. I am going to dig a little deeper into it and see if I can get some more information / figure it out :) |
@KITSDominicWhite No worries! If i can assist or if you get it working, please let me know. |
+1 to this issue |
+1 |
I have Does this issue only occur on Linux / macOS? |
Worked for me on Windows, after putting the php executable on the PATH. It just gave me a hard time, as the error message when PHP is not installed was quite hard to understand. No issues on Gulp 4.0 though. |
it stopped working after requiring database connection (db.php) |
I am currently trying to get gulp-connect-php running on a gulp4.0 version. I have tried with my existing gulp file and with a standalone project, Neither to much joy.
This tends to be the issue that appears with the following gulpfile.js:
Is there any possibility of getting this working with the new gulp4.0?
The text was updated successfully, but these errors were encountered: