-
Notifications
You must be signed in to change notification settings - Fork 744
Copy not accepting source end with wildcards * when using -r on v0.6.0 #389
Copy link
Copy link
Closed
Description
Hi, when I use shelljs V0.6.0, I get the error:
shelljs.cp('-r', '/Users/chenzs/wksps/work/cybertron/publish-common/workDirectory/output/zip/*', '/Users/chenzs/wksps/work/cybertron/publish-common/workDirectory/');
shell.js: internal error
Error: ENOENT: no such file or directory, stat '/Users/chenzs/wksps/work/cybertron/publish-common/workDirectory/output/zip/*'
at Error (native)
at Object.fs.statSync (fs.js:892:18)
at /Users/chenzs/wksps/work/cybertron/publish-common/node_modules/shelljs/src/cp.js:148:21
at Array.forEach (native)
at Object._cp (/Users/chenzs/wksps/work/cybertron/publish-common/node_modules/shelljs/src/cp.js:144:13)
at Object.cp (/Users/chenzs/wksps/work/cybertron/publish-common/node_modules/shelljs/src/common.js:240:23)
at repl:1:4
at REPLServer.defaultEval (repl.js:262:27)
at bound (domain.js:287:14)
at REPLServer.runBound [as eval] (domain.js:300:12)
using node v5.7.1 on OSX 10.11.3 (15D21) .
Then I view cp.js at line 148
if (options.recursive) {
// Recursive allows the shortcut syntax "sourcedir/" for "sourcedir/*"
// (see Github issue #15)
sources.forEach(function(src, i) {
if (src[src.length - 1] === '/') {
sources[i] += '*';
// If src is a directory and dest doesn't exist, 'cp -r src dest' should copy src/* into dest
} else if (fs.statSync(src).isDirectory() && !exists) { // here is the error?
// but fs.statSync do not support wildcards *
sources[i] += '/*';
}
});
// Create dest
try {
fs.mkdirSync(dest, parseInt('0777', 8));
} catch (e) {
// like Unix's cp, keep going even if we can't create dest dir
}
}fs.statSync do not support wildcards but src is a string with wildcards (arguments without any converting).
Is this a bug? Or shelljs.cp do not support wildcards any more since v0.6.0?
But the README says: The wildcard * is accepted.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels