Skip to content

Commit

Permalink
strange behavior: stream could be a string ! see apocas/dockerode#456
Browse files Browse the repository at this point in the history
  • Loading branch information
kerphi committed Jun 12, 2018
1 parent 7c20709 commit 18754e7
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions ezmaster-api/routes/v1-instances.js
Original file line number Diff line number Diff line change
Expand Up @@ -687,12 +687,19 @@ router
if (err) {
return res.status(err.statusCode).send(err.reason).end();
}
stream.on('data', (chunk) => {
res.write(stripAnsi(chunk.toString()));
});
stream.on('end', () => {
// strange behavior: stream could be a string !
// see https://github.com/apocas/dockerode/issues/456
if (typeof(stream) === 'string') {
res.write(stripAnsi(stream));
res.end();
});
} else {
stream.on('data', (chunk) => {
res.write(stripAnsi(chunk.toString()));
});
stream.on('end', () => {
res.end();
});
}
});
});
});
Expand Down

1 comment on commit 18754e7

@kerphi
Copy link
Contributor Author

@kerphi kerphi commented on 18754e7 Jun 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.