ascii-progress icon indicating copy to clipboard operation
ascii-progress copied to clipboard

Just stops after a while and ends the process

Open darlenya opened this issue 7 years ago • 2 comments

Hi I used it under Mac OS 10.13.3 with node v9.5.0 When running it with a bigger amount of cycles it crashes after a while.

This example code shows the problem:

const ProgressBar = require('ascii-progress')

const TOTAL_TESTCASE = 251
const TOTAL_STEPS = 628

const barTestcase = new ProgressBar({
    schema:
        'Test cases: [:bar.yellow] :current/:total :percent :elapseds :etas <:name>',
    total: TOTAL_TESTCASE,
    clear: false,
})

const barStep = new ProgressBar({
    schema:
        'Steps:      [:bar.green] :current/:total :percent :elapseds :etas <:name>',
    total: TOTAL_STEPS,
    clear: false,
})

// make the bars Visible in the right order
barTestcase.tick()
barTestcase.tick(-1)

barStep.tick()
barStep.tick(-1)


for(let stepCount =0; stepCount<TOTAL_STEPS; stepCount++){
    barStep.tick()
    for(let tcCount =0; tcCount<TOTAL_TESTCASE; tcCount++){
        barTestcase.tick()
    }
    barTestcase.tick(-TOTAL_TESTCASE)
}

darlenya avatar Feb 20 '18 09:02 darlenya

I just spent a day figuring this out. The issue is in the [email protected] which is used in the latest released version of [email protected]. The ([email protected]) function opens a new terminal with each call, resulting in a new file descriptor and it doesn't close it = thus the "too many open files" error (I believe you would get it after waiting some time after your app freezes). The latest version [email protected] has this fixed.

@bubkoo can you please let us know when is the next release of ascii-progress planned? I can see you have already fixed the get-cursor-position version in the package.json, it's just not released. Thanks for any info!

vrockai avatar Jun 13 '18 13:06 vrockai

FTW, I've just found the package is release under a new name node-progress-bars, @darlenya if you use this package instead of ascii-progress I believe your error would be resolved.

vrockai avatar Jun 13 '18 14:06 vrockai