sindresorhus/trash

Trash with globs exclusion needs to be passed array of paths from Globby

Cloud7050 opened this issue · 3 comments

When running this code:

	let trashArr = [
		"./public/img",
		"!./public/img/*/**"
	];
	Trash(trashArr);

I get this error:

(node:15172) UnhandledPromiseRejectionWarning: Error: Command failed: D:\x\node_modules\trash\lib\windows-trash.exe D:\x\public\img

    at ChildProcess.exithandler (child_process.js:275:12)
    at emitTwo (events.js:126:13)
    at ChildProcess.emit (events.js:214:7)
    at maybeClose (internal/child_process.js:925:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)

But this code works as expected:

	let trashArr = [
		"./public/img",
		"!./public/img/*/**"
	];
	Globby(trashArr).then(paths => Trash(paths));

I was able to run your example code without errors, would you mind adding some information to help replicate this situation?

Hello, thanks for the response. May I know what additional information I can provide that would help?

I would think packages and node versions, and operating system.