Skip to content
This repository was archived by the owner on Feb 1, 2022. It is now read-only.
This repository was archived by the owner on Feb 1, 2022. It is now read-only.

Flush never hits drain condition #376

@devshorts

Description

@devshorts

It seems that flush should be checking the result of process.stdout.write to see if it was already flushed or not. For example

async function flush() {
    const p = new Promise(resolve => process.stdout.once('drain', () => resolve()));
    const flushed = process.stdout.write('');

    if(flushed) {
      return Promise.resolve()
    }

    return p;
  }

If it's NOT flushed, then wait for drain. Otherwise because it's already drained the event never seems to fire so the other promise.race always wins

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions