Skip to content

Commit

Permalink
Re-complexify handleCommon().
Browse files Browse the repository at this point in the history
I'd forgotten that `Cat` would need this.
  • Loading branch information
Dan Bornstein committed Jul 15, 2012
1 parent 6f91435 commit 2d97a4c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lib/opts.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ function validate(options, allowed) {
* Handles the three common options `encoding`, `incomingEncoding`, and
* `paused`.
*/
function handleCommon(options, target) {
function handleCommon(options, target, constructedPaused) {
if (options.encoding) {
target.setEncoding(options.encoding);
}
Expand All @@ -132,8 +132,14 @@ function handleCommon(options, target) {
target.setIncomingEncoding(options.incomingEncoding);
}

if (options.paused) {
target.pause();
if (typ.isDefined(options.paused)) {
if (options.paused) {
if (!constructedPaused) {
target.pause();
}
} else if (constructedPaused) {
target.resume();
}
}
}

Expand Down

0 comments on commit 2d97a4c

Please sign in to comment.