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

apparent missing "not" in description of grunt.async #17

Closed
gdennie opened this Issue Nov 25, 2013 · 5 comments

Comments

Projects
None yet
2 participants
@gdennie

gdennie commented Nov 25, 2013

If a task is asynchronous, this method must be invoked to instruct Grunt to not wait.

@shama

This comment has been minimized.

Show comment
Hide comment
@shama

shama Nov 25, 2013

Member

By default Grunt is synchronous and will not wait for your task before completing. If your task is asynchronous, calling this.async() will have Grunt wait until the done function is called before completing. I think the wording in the docs currently is correct.

Member

shama commented Nov 25, 2013

By default Grunt is synchronous and will not wait for your task before completing. If your task is asynchronous, calling this.async() will have Grunt wait until the done function is called before completing. I think the wording in the docs currently is correct.

@gdennie

This comment has been minimized.

Show comment
Hide comment
@gdennie

gdennie Nov 25, 2013

Synchronous means ordered and is often synonymous with sequential (which is a bit overly specific). Asynchronous means unordered and often implies simultaneity in multi-tasking systems. Hence, Asynchronous programming. Consequently, a treatment might be as follows:

“By default Grunt executes tasks asynchronously in that they are not sequenced to occur in a particular order such as sequentially and may in fact occur simultaneously. To prevent simultaneous execution of itself with others, the task must call this.async() and use the done function, the equivalent of the ‘return’ command, to indicate when it is done. “

From: Kyle ☱☲☳☴☵☷ ☶ Robinson ☱☲ ☳☴☵☶☷ Young [mailto:notifications@github.com]
Sent: November 24, 2013 10:58 PM
To: gruntjs/grunt-docs
Cc: gdennie
Subject: Re: [grunt-docs] apparent missing "not" in description of grunt.async (#17)

By default Grunt is synchronous and will not wait for your task before completing. If your task is asynchronous, calling this.async() will have Grunt wait until the done function is called before completing. I think the wording in the docs currently is correct.


Reply to this email directly or view it on GitHub #17 (comment) .Image removed by sender.

gdennie commented Nov 25, 2013

Synchronous means ordered and is often synonymous with sequential (which is a bit overly specific). Asynchronous means unordered and often implies simultaneity in multi-tasking systems. Hence, Asynchronous programming. Consequently, a treatment might be as follows:

“By default Grunt executes tasks asynchronously in that they are not sequenced to occur in a particular order such as sequentially and may in fact occur simultaneously. To prevent simultaneous execution of itself with others, the task must call this.async() and use the done function, the equivalent of the ‘return’ command, to indicate when it is done. “

From: Kyle ☱☲☳☴☵☷ ☶ Robinson ☱☲ ☳☴☵☶☷ Young [mailto:notifications@github.com]
Sent: November 24, 2013 10:58 PM
To: gruntjs/grunt-docs
Cc: gdennie
Subject: Re: [grunt-docs] apparent missing "not" in description of grunt.async (#17)

By default Grunt is synchronous and will not wait for your task before completing. If your task is asynchronous, calling this.async() will have Grunt wait until the done function is called before completing. I think the wording in the docs currently is correct.


Reply to this email directly or view it on GitHub #17 (comment) .Image removed by sender.

@gdennie

This comment has been minimized.

Show comment
Hide comment
@gdennie

gdennie Nov 25, 2013

I have rearrange my production environment and having a hard time getting my distribution folder to work.

Are you able to lend a hand?

I am new to grunt its various task. J

From: Kyle ☱☲☳☴☵☷ ☶ Robinson ☱☲ ☳☴☵☶☷ Young [mailto:notifications@github.com]
Sent: November 24, 2013 10:58 PM
To: gruntjs/grunt-docs
Cc: gdennie
Subject: Re: [grunt-docs] apparent missing "not" in description of grunt.async (#17)

By default Grunt is synchronous and will not wait for your task before completing. If your task is asynchronous, calling this.async() will have Grunt wait until the done function is called before completing. I think the wording in the docs currently is correct.


Reply to this email directly or view it on GitHub #17 (comment) .Image removed by sender.

gdennie commented Nov 25, 2013

I have rearrange my production environment and having a hard time getting my distribution folder to work.

Are you able to lend a hand?

I am new to grunt its various task. J

From: Kyle ☱☲☳☴☵☷ ☶ Robinson ☱☲ ☳☴☵☶☷ Young [mailto:notifications@github.com]
Sent: November 24, 2013 10:58 PM
To: gruntjs/grunt-docs
Cc: gdennie
Subject: Re: [grunt-docs] apparent missing "not" in description of grunt.async (#17)

By default Grunt is synchronous and will not wait for your task before completing. If your task is asynchronous, calling this.async() will have Grunt wait until the done function is called before completing. I think the wording in the docs currently is correct.


Reply to this email directly or view it on GitHub #17 (comment) .Image removed by sender.

@shama

This comment has been minimized.

Show comment
Hide comment
@shama

shama Nov 26, 2013

Member

The current wording in the docs is correct. Grunt by default is synchronous. Consider the example:

grunt.registerTask('later', function() {
  setTimeout(function() {
    grunt.log.writeln('I WILL BE CALLED IN 2 SECONDS');
  }, 2000);
});
grunt.registerTask('now', function() {
  grunt.log.writeln('I WILL BE CALLED IMMEDIATELY');
});
grunt.registerTask('default', ['later', 'now']);

Grunt will consider the above later task as synchronous. It will immediately run the next task now after it and then exit. Thus never displaying 'I WILL BE CALLED IN 2 SECONDS'.

You need to tell Grunt that your task is asynchronous by changing it to:

grunt.registerTask('later', function() {
  var done = this.async();
  setTimeout(function() {
    grunt.log.writeln('I WILL BE CALLED IN 2 SECONDS');
    done();
  }, 2000);
});

Which will wait until done() is called before continuing to the next task.

and no I cannot help you with your work. I am a volunteer and only interested in addressing issues within Grunt. Good luck though!

Member

shama commented Nov 26, 2013

The current wording in the docs is correct. Grunt by default is synchronous. Consider the example:

grunt.registerTask('later', function() {
  setTimeout(function() {
    grunt.log.writeln('I WILL BE CALLED IN 2 SECONDS');
  }, 2000);
});
grunt.registerTask('now', function() {
  grunt.log.writeln('I WILL BE CALLED IMMEDIATELY');
});
grunt.registerTask('default', ['later', 'now']);

Grunt will consider the above later task as synchronous. It will immediately run the next task now after it and then exit. Thus never displaying 'I WILL BE CALLED IN 2 SECONDS'.

You need to tell Grunt that your task is asynchronous by changing it to:

grunt.registerTask('later', function() {
  var done = this.async();
  setTimeout(function() {
    grunt.log.writeln('I WILL BE CALLED IN 2 SECONDS');
    done();
  }, 2000);
});

Which will wait until done() is called before continuing to the next task.

and no I cannot help you with your work. I am a volunteer and only interested in addressing issues within Grunt. Good luck though!

@shama shama closed this Nov 26, 2013

@gdennie

This comment has been minimized.

Show comment
Hide comment
@gdennie

gdennie Nov 26, 2013

Hi Kyle,

Uhmm. I see.

So after a task returns, grunt then takes pains to ensure all it’s outstanding child processes, such as timers, are killed immediately or perhaps silently prevents any child processes from even being started. And so, to prevent this, the task must call this.async() before returning or starting such processes, respectively? Is that the case, if you know?

Such efforts by grunt, while implied by the synchronous statement, is so non-standard in conventional procedural coding patterns that it bears some elaboration. On the other hand, in functional programs, I believe the grunt task runner would be characterized as a monad – a function runner (my own interim take on monads J ).

Thanks for your patience.

George.

From: Kyle ☱☲☳☴☵☷ ☶ Robinson ☱☲ ☳☴☵☶☷ Young [mailto:notifications@github.com]
Sent: November 25, 2013 11:30 PM
To: gruntjs/grunt-docs
Cc: gdennie
Subject: Re: [grunt-docs] apparent missing "not" in description of grunt.async (#17)

The current wording in the docs is correct. Grunt by default is synchronous. Consider the example:

grunt.registerTask('later', function() {
setTimeout(function() {
grunt.log.writeln('I WILL BE CALLED IN 2 SECONDS');
}, 2000);
});
grunt.registerTask('now', function() {
grunt.log.writeln('I WILL BE CALLED IMMEDIATELY');
});
grunt.registerTask('default', ['later', 'now']);

Grunt will consider the above later task as synchronous. It will immediately run the next task now after it and then exit. Thus never displaying 'I WILL BE CALLED IN 2 SECONDS'.

You need to tell Grunt that your task is asynchronous by changing it to:

grunt.registerTask('later', function() {
var done = this.async();
setTimeout(function() {
grunt.log.writeln('I WILL BE CALLED IN 2 SECONDS');
done();
}, 2000);
});

Which will wait until done() is called before continuing to the next task.

and no I cannot help you with your work. I am a volunteer and only interested in addressing issues within Grunt. Good luck though!


Reply to this email directly or view it on GitHub #17 (comment) .Image removed by sender.

gdennie commented Nov 26, 2013

Hi Kyle,

Uhmm. I see.

So after a task returns, grunt then takes pains to ensure all it’s outstanding child processes, such as timers, are killed immediately or perhaps silently prevents any child processes from even being started. And so, to prevent this, the task must call this.async() before returning or starting such processes, respectively? Is that the case, if you know?

Such efforts by grunt, while implied by the synchronous statement, is so non-standard in conventional procedural coding patterns that it bears some elaboration. On the other hand, in functional programs, I believe the grunt task runner would be characterized as a monad – a function runner (my own interim take on monads J ).

Thanks for your patience.

George.

From: Kyle ☱☲☳☴☵☷ ☶ Robinson ☱☲ ☳☴☵☶☷ Young [mailto:notifications@github.com]
Sent: November 25, 2013 11:30 PM
To: gruntjs/grunt-docs
Cc: gdennie
Subject: Re: [grunt-docs] apparent missing "not" in description of grunt.async (#17)

The current wording in the docs is correct. Grunt by default is synchronous. Consider the example:

grunt.registerTask('later', function() {
setTimeout(function() {
grunt.log.writeln('I WILL BE CALLED IN 2 SECONDS');
}, 2000);
});
grunt.registerTask('now', function() {
grunt.log.writeln('I WILL BE CALLED IMMEDIATELY');
});
grunt.registerTask('default', ['later', 'now']);

Grunt will consider the above later task as synchronous. It will immediately run the next task now after it and then exit. Thus never displaying 'I WILL BE CALLED IN 2 SECONDS'.

You need to tell Grunt that your task is asynchronous by changing it to:

grunt.registerTask('later', function() {
var done = this.async();
setTimeout(function() {
grunt.log.writeln('I WILL BE CALLED IN 2 SECONDS');
done();
}, 2000);
});

Which will wait until done() is called before continuing to the next task.

and no I cannot help you with your work. I am a volunteer and only interested in addressing issues within Grunt. Good luck though!


Reply to this email directly or view it on GitHub #17 (comment) .Image removed by sender.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment