You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Node version (or tell us if you're using electron or some other framework):
electron v1.4.8
node v7.1.0
ShellJS version (the most recent version/Github branch you see the bug on):
shelljs v.0.7.5
Operating system:
macOS Sierra 10.12.1
Windows 8.1
Description of the bug:
Getting rm: could not remove file (code ENOTDIR) errors when running recursive rm in Electron to remove a directory and the directory happens to contain an asar archive.
I believe that this is caused by the fact that Electron patches fs to treat asar files as virtual directories. Thus, ShellJS sees the .asar file as a directory and attempts to remove all individual files as given by fs.readdir('example.asar').
Monkey patching rm.js to require original-fs seems to solve it.
I expected similar problems with cp -r, but doing a quick test that seems to work without issues.
Now, I am very new in the industry, so I'd need some guidance on crafting a good PR and discuss what makes the most sense to do here. Would checking if original-fs is available and using it in rm.js be the best solution, or should this be extended globally? Do you think this could potentially have some unwanted side effects or can think of a better solution?
Thank you!
Example ShellJS command to reproduce the error:
// Somewhere in main or renderer Electron jsconstshelljs=require('shelljs')shelljs.rm('-rf','/PathToADirectoryContainingAsarArchive')