(total, startValue, payload)
| 60 | |
| 61 | // start the progress bar |
| 62 | start(total, startValue, payload){ |
| 63 | // progress updates are only visible in TTY mode! |
| 64 | if (this.options.noTTYOutput === false && this.terminal.isTTY() === false){ |
| 65 | return; |
| 66 | } |
| 67 | |
| 68 | // add handler to restore cursor settings (stop the bar) on SIGINT/SIGTERM ? |
| 69 | if (this.sigintCallback === null && this.options.gracefulExit){ |
| 70 | this.sigintCallback = this.stop.bind(this); |
| 71 | process.once('SIGINT', this.sigintCallback); |
| 72 | process.once('SIGTERM', this.sigintCallback); |
| 73 | } |
| 74 | |
| 75 | // save current cursor settings |
| 76 | this.terminal.cursorSave(); |
| 77 | |
| 78 | // hide the cursor ? |
| 79 | if (this.options.hideCursor === true){ |
| 80 | this.terminal.cursor(false); |
| 81 | } |
| 82 | |
| 83 | // disable line wrapping ? |
| 84 | if (this.options.linewrap === false){ |
| 85 | this.terminal.lineWrapping(false); |
| 86 | } |
| 87 | |
| 88 | // initialize bar |
| 89 | super.start(total, startValue, payload); |
| 90 | |
| 91 | // redraw on start! |
| 92 | this.render(); |
| 93 | } |
| 94 | |
| 95 | // stop the bar |
| 96 | stop(){ |
no test coverage detected