Skip to content

Commit

Permalink
fixed #117
Browse files Browse the repository at this point in the history
  • Loading branch information
AndiDittrich committed May 1, 2022
1 parent c1b9375 commit 00e6576
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* Added: `log()` convenience method the multibar to enable custom logging output on top of the progress bars during operation
* Added: `gracefulExit` option (enabled by default) to stop the bars in case of `SIGINT` or `SIGTERM` - this restores most cursor settings before exiting
* Bugfix: within a non-tty environment (e.g. CI/CD taskrunners) `multibar.create()` returns an undefined value in case `noTTYOutput` is not enabled #117

### 3.10.0 ###

Expand Down
3 changes: 2 additions & 1 deletion examples/example-multibar.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ const multibar = new _progress.MultiBar({
barCompleteChar: '\u2588',
barIncompleteChar: '\u2591',
clearOnComplete: true,
stopOnComplete: true
stopOnComplete: true,
noTTYOutput: true
});

console.log("Downloading files..\n");
Expand Down
2 changes: 1 addition & 1 deletion examples/example-notty.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

// open 1-way read handle (stdout+stderr)
$handle = popen('/usr/bin/node example.js 2>&1', 'r');
$handle = popen('/usr/bin/node example-multibar.js 2>&1', 'r');

// fetch content
while (!feof($handle)) {
Expand Down
10 changes: 5 additions & 5 deletions lib/multi-bar.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,17 @@ module.exports = class MultiBar extends _EventEmitter{

// add a new bar to the stack
create(total, startValue, payload){
// progress updates are only visible in TTY mode!
if (this.options.noTTYOutput === false && this.terminal.isTTY() === false){
return;
}

// create new bar element
const bar = new _BarElement(this.options);

// store bar
this.bars.push(bar);

// progress updates are only visible in TTY mode!
if (this.options.noTTYOutput === false && this.terminal.isTTY() === false){
return bar;
}

// multiprogress already active ?
if (!this.isActive){
// hide the cursor ?
Expand Down

0 comments on commit 00e6576

Please sign in to comment.