diff --git a/lib/copy-sync/copy-sync.js b/lib/copy-sync/copy-sync.js index d837780c..2d9523ec 100644 --- a/lib/copy-sync/copy-sync.js +++ b/lib/copy-sync/copy-sync.js @@ -47,6 +47,9 @@ function getStats (destStat, src, dest, opts) { srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts) else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts) + else if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`) + else if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`) + throw new Error(`Unknown file: ${src}`) } function onFile (srcStat, destStat, src, dest, opts) { diff --git a/lib/copy/copy.js b/lib/copy/copy.js index 14aab7d5..c12578db 100644 --- a/lib/copy/copy.js +++ b/lib/copy/copy.js @@ -72,6 +72,9 @@ function getStats (destStat, src, dest, opts, cb) { srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts, cb) else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts, cb) + else if (srcStat.isSocket()) return cb(new Error(`Cannot copy a socket file: ${src}`)) + else if (srcStat.isFIFO()) return cb(new Error(`Cannot copy a FIFO pipe: ${src}`)) + return cb(new Error(`Unknown file: ${src}`)) }) }