Skip to content

Commit ab1654b

Browse files
Add basename from source when it is a folder
1 parent 249ccf3 commit ab1654b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

node/task.ts

+5
Original file line numberDiff line numberDiff line change
@@ -987,6 +987,11 @@ export function cp(source: string, dest: string, options?: string, continueOnErr
987987
try {
988988
let isRecursive = options?.toLowerCase()?.includes('-r');
989989
let isForce = options?.toLowerCase()?.includes('-f');
990+
991+
if (fs.lstatSync(source).isDirectory()) {
992+
dest = path.join(dest, path.basename(source));
993+
}
994+
990995
fs.cpSync(source, dest, { recursive: isRecursive, force: isForce });
991996
} catch (error) {
992997
debug('cp failed');

0 commit comments

Comments
 (0)