-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1184 from oclif/mdonnalley/write
fix: handle large throughput writes
- Loading branch information
Showing
2 changed files
with
40 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,24 @@ | ||
import {format} from 'node:util' | ||
|
||
export const stdout = (str?: string | string[] | undefined, ...args: string[]): void => { | ||
if (!str && args) { | ||
process.stdout.write(format(...args) + '\n') | ||
console.log(format(...args)) | ||
} else if (!str) { | ||
process.stdout.write('\n') | ||
console.log() | ||
} else if (typeof str === 'string') { | ||
process.stdout.write((str && format(str, ...args)) + '\n') | ||
console.log(format(str, ...args)) | ||
} else { | ||
process.stdout.write(format(...str, ...args) + '\n') | ||
console.log(format(...str, ...args)) | ||
} | ||
} | ||
|
||
export const stderr = (str?: string | string[] | undefined, ...args: string[]): void => { | ||
if (!str && args) { | ||
process.stderr.write(format(...args) + '\n') | ||
console.error(format(...args)) | ||
} else if (!str) { | ||
process.stderr.write('\n') | ||
console.error() | ||
} else if (typeof str === 'string') { | ||
process.stderr.write((str && format(str, ...args)) + '\n') | ||
console.error(format(str, ...args)) | ||
} else { | ||
process.stderr.write(format(...str, ...args) + '\n') | ||
console.error(format(...str, ...args)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters