Skip to content

Commit

Permalink
refactor: replace console.warn with process.emitWarning (#954)
Browse files Browse the repository at this point in the history
Signed-off-by: Lam Wei Li <peteriman@mail.com>
  • Loading branch information
lamweili committed Apr 16, 2022
1 parent 5cadd76 commit baa9934
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
7 changes: 5 additions & 2 deletions lib/copy/copy-sync.js
Expand Up @@ -17,8 +17,11 @@ function copySync (src, dest, opts) {

// Warn about using preserveTimestamps on 32-bit node
if (opts.preserveTimestamps && process.arch === 'ia32') {
console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n
see https://github.com/jprichardson/node-fs-extra/issues/269`)
process.emitWarning(
'Using the preserveTimestamps option in 32-bit node is not recommended;\n\n' +
'\tsee https://github.com/jprichardson/node-fs-extra/issues/269',
'Warning', 'fs-extra-WARN0002'
)
}

const { srcStat, destStat } = stat.checkPathsSync(src, dest, 'copy', opts)
Expand Down
7 changes: 5 additions & 2 deletions lib/copy/copy.js
Expand Up @@ -23,8 +23,11 @@ function copy (src, dest, opts, cb) {

// Warn about using preserveTimestamps on 32-bit node
if (opts.preserveTimestamps && process.arch === 'ia32') {
console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;\n
see https://github.com/jprichardson/node-fs-extra/issues/269`)
process.emitWarning(
'Using the preserveTimestamps option in 32-bit node is not recommended;\n\n' +
'\tsee https://github.com/jprichardson/node-fs-extra/issues/269',
'Warning', 'fs-extra-WARN0001'
)
}

stat.checkPaths(src, dest, 'copy', opts, (err, stats) => {
Expand Down

0 comments on commit baa9934

Please sign in to comment.