Skip to content

Commit 7e529a6

Browse files
committed
fix Transport#waitFor()
1 parent 97bff09 commit 7e529a6

File tree

6 files changed

+14
-10
lines changed

6 files changed

+14
-10
lines changed

lib/flight.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Flight.prototype = {
4141
var future = new Future();
4242

4343
var task = function() {
44-
new Fiber(function() {
44+
Fiber(function() {
4545
var t = process.hrtime();
4646

4747
var transport = new this.transportClass(this);

lib/flightplan.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -349,8 +349,7 @@ Flightplan.prototype = {
349349
, 'with '.info + String(flightsForTask.length).magenta + ' flight(s)'.info);
350350
this.logger.space();
351351

352-
new Fiber(function() {
353-
352+
Fiber(function() {
354353
var t = process.hrtime();
355354

356355
for(var i=0, len=flightsForTask.length; i < len; i++) {
@@ -393,7 +392,6 @@ Flightplan.prototype = {
393392
this.debriefingCallback();
394393
process.exit(0);
395394
}
396-
397395
}.bind(this)).run();
398396
}
399397

lib/remote.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ RemoteFlight.prototype.__start = function() {
1818
var task = function(host) {
1919
var future = new Future();
2020
var flight = new RemoteFlight(this.flightplan, this.fn);
21-
new Fiber(function() {
21+
Fiber(function() {
2222
var t = process.hrtime();
2323

2424
var transport = new flight.transportClass(flight, host);

lib/transport/index.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var util = require('util')
22
, Fiber = require('fibers')
3+
, Future = require('fibers/future')
34
, prompt = require('prompt')
45
, commands = require('./commands');
56

@@ -303,9 +304,14 @@ Transport.prototype = {
303304
* @return mixed
304305
*/
305306
waitFor: function(fn) {
306-
var fiber = Fiber.current;
307-
fn(function(ret) { fiber.run(ret); });
308-
return Fiber.yield();
307+
function task() {
308+
var future = new Future();
309+
fn(function(ret) {
310+
future.return(ret);
311+
});
312+
return future;
313+
}
314+
Future.wait(task());
309315
},
310316

311317
/**

lib/transport/shell.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ ShellTransport.prototype.__transfer = function(files, remoteDir, options) {
8888
var task = function(config) {
8989
var future = new Future();
9090

91-
new Fiber(function() {
91+
Fiber(function() {
9292
var sshFlags = (config.privateKey ? ' -i ' + config.privateKey : '');
9393
var remoteUrl = util.format('%s%s:%s'
9494
, (config.username ? config.username + '@' : '')

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "flightplan",
33
"description": "Library for streamlining application deployment or systems administration tasks",
4-
"version": "0.4.4",
4+
"version": "0.4.5",
55
"author": "Patrick Stadler <[email protected]>",
66
"keywords": [
77
"deploy",

0 commit comments

Comments
 (0)