Comments (4)
Can't reproduce. Are you sure it's time-grunt
? Try upgrading Node.
from time-grunt.
I found the issue. Most tasks in grunt are synchronous. In our case our default task is a big synchronous task which does a lot of sync file IO (grunt.file.write
etc).
In node when nothing catches SIGINT it just terminates the process immediately. But when time-grunt
catches SIGINT
node will dispatch the javascript code to run for it.
The problem is that our big task (any many others like grunt-uglify
or grunt-contrib-cssmin
) are all synchronous and don't yield for the SIGINT code to run.
This can be seen with this simple Gruntfile:
module.exports = function(grunt) {
require('time-grunt')(grunt);
grunt.registerTask('default', function() {
console.log('testing...');
var end = Date.now() + 4000;
while (Date.now() < end) {
grunt.file.write('test', 'test');
}
console.log('done');
});
};
Try killing it with Ctrl+C and you'll see it only gets killed after the task completes. Now remove time-grunt
to remove the SIGINT handler, try killing it again, and you'll see it is killed immediately.
So in conclusion: because most grunt tasks are written in a synchronous way there is nothing time-grunt
can do about this issue. Except for maybe document this behavior.
from time-grunt.
I would suggest removing
Lines 147 to 149 in d850113
For now the workaround we're using is:
var processOn = process.on;
process.on = function(what,cb) {if(what!=='SIGINT'){processOn.call(process,what,cb);}};
require('time-grunt')(grunt);
process.on = processOn;
from time-grunt.
Closing as this project is deprecated because Grunt is no longer actively maintained, so it doesn't make sense for me to maintain this project either.
from time-grunt.
Related Issues (20)
- Execution start time is always in UTC HOT 8
- Feature request: Ignore Tasks HOT 3
- allow custom barChar character, or non utf8 option HOT 4
- builder is not defined HOT 1
- Command line support HOT 5
- `createBar` invalid array length exception due to negative maxBarWidth HOT 4
- [feature] Allow depth configuration or whitelist HOT 4
- Execution time (date+time) is wrong HOT 1
- --no-color flag does nothing HOT 3
- TypeError: chalk.stripColor is not a function HOT 1
- Maintainer needed HOT 4
- xo 0.15.0 throwing lint error
- Abstracted grunt hooks package HOT 4
- Not outputting total elapsed time unless grunt is called with `--no-color` option HOT 5
- Disable for independent runs
- Callback is not called when exit HOT 1
- Prevents Jest from completion HOT 1
- LESS option 'spawn HOT 1
- grunt-contrib-watch option 'spawn': false blocks time-grunt? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from time-grunt.