Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot delete .asar file while VS Code is open #646

Closed
elisee opened this issue Nov 25, 2015 · 17 comments
Closed

Cannot delete .asar file while VS Code is open #646

elisee opened this issue Nov 25, 2015 · 17 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug upstream Issue identified as 'upstream' component related (exists outside of VS Code) verified Verification succeeded
Milestone

Comments

@elisee
Copy link

elisee commented Nov 25, 2015

Hi!

It looks like VS Code opens .asar files to make them browsable in the workspace tree view. That sounds helpful, except it seems like a file handle is kept open at all times, preventing some packaging script of mine from deleting .asar files if I keep VS Code open when running it.

Would it be possible to ensure .asar files are only opened by VS Code if they are being browsed explicitely in the tree view? or maybe avoid keeping the file handle open on them while idling?

I'm running VS Code 0.10.2 on Windows 7 64-bit.
Thanks for a great editor! ♥

@bpasero bpasero added bug Issue identified by VS Code Team member as probable bug upstream Issue identified as 'upstream' component related (exists outside of VS Code) labels Nov 25, 2015
@bpasero
Copy link
Member

bpasero commented Nov 25, 2015

@elisee not much we can do here really because Electron decides to treat asar files very special. See electron/electron#1658

@elisee
Copy link
Author

elisee commented Nov 26, 2015

Ah. Reading the bug you linked, I wonder if VSCode could maybe require original-fs in the workspace tree code instead of fs so that .asar files aren't treated special? Obviously I have no experience with the actual code so it might not be manageable, but just putting it out there...

@bpasero
Copy link
Member

bpasero commented Nov 26, 2015

Maybe, but it's ugly to force everyone to remember to not use fs module.

@bpasero bpasero modified the milestone: Backlog Nov 26, 2015
@stanleyxu2005
Copy link

Hi Team, I have the same issue with the latest build of vscode. I open my project with vscode, the foo.asar is located in dist. I never intend to open this file in vscode at all. But vscode is able to list its contents. That's why the file cannot be deleted. I'd like to know, if vscode has the possibility not to preview asar file content.

@bpasero bpasero modified the milestones: June 2016, Backlog Jun 4, 2016
@bpasero
Copy link
Member

bpasero commented Jun 4, 2016

We should try to set the process.noAsar flag early on. This will disable any support to view *.asar files in the explorer but this was also never intended.

@bpasero
Copy link
Member

bpasero commented Jun 4, 2016

Actually we cannot set process.noAsar because that disables loading of any renderer side electron module...

@bpasero bpasero modified the milestones: June 2016, Backlog Jun 5, 2016
@keyiis
Copy link

keyiis commented Jun 22, 2016

@bpasero This is an annoying problem,every time when I run the build script i have to close vscode first,but my present job require electron,so I have to consider other editor?

@bpasero
Copy link
Member

bpasero commented Jun 22, 2016

I will see if there is a way to prevent the locking from happening.

@bpasero bpasero modified the milestones: June 2016, Backlog Jun 22, 2016
@bpasero
Copy link
Member

bpasero commented Jun 27, 2016

I opened electron/electron#6251 as related upstream issue and hope that Electron can do something about it.

@bpasero bpasero modified the milestones: Backlog, June 2016 Jun 27, 2016
@bpasero bpasero modified the milestones: June 2016, Backlog Jun 27, 2016
@bpasero bpasero assigned isidorn and unassigned bpasero Jun 27, 2016
@bpasero
Copy link
Member

bpasero commented Jun 27, 2016

Pushed a change to treat *.asar as normal files and not directories. It is not 100% possible for us to prevent the locking because it seems a simple fs.stat or fs.readdir on such a file is sufficient to have it locked. But I went through our places of such calls and handle *.asar specially now. Let's see how it goes.

As a consequence you can no longer expand and browse in asar files. But that was also never the intent of VS Code to do so in the first place because these files are very special to Electron.

@dbaeumer dbaeumer added the verified Verification succeeded label Jul 1, 2016
@weinand weinand added verification-found Issue verification failed and removed verified Verification succeeded labels Jul 4, 2016
@weinand weinand assigned bpasero and unassigned isidorn Jul 4, 2016
@weinand
Copy link
Contributor

weinand commented Jul 4, 2016

I can no longer open *.asar file within VS Code (which is correct), but I'm still able to open an *.asar from the command line. It shows up as an empty project folder and trying to create a file there runs into errors:

2016-07-04_12-10-24

@weinand weinand reopened this Jul 4, 2016
@bpasero
Copy link
Member

bpasero commented Jul 4, 2016

@weinand thanks, can you open a separate issue on this? I think the original issue should be verified.

@bpasero bpasero closed this as completed Jul 4, 2016
@weinand
Copy link
Contributor

weinand commented Jul 4, 2016

@bpasero I'll create a new issue.
BTW, the *.asar opened from the command line cannot be deleted as long as VS Code is open, so I did verify the original issue.

@bpasero
Copy link
Member

bpasero commented Jul 4, 2016

@weinand good point, though I think that is not a very typical scenario and also not what the users are complaining about.

@weinand weinand added verified Verification succeeded and removed verification-found Issue verification failed labels Jul 4, 2016
@a11smiles
Copy link

a11smiles commented Sep 29, 2016

I'm running 1.5.3 and this issue still remains

I've also tried 'ignoring' the dist folder in my user settings, but that doesn't help either. This is a big problem with using VSCode to develop electron apps.

@bpasero
Copy link
Member

bpasero commented Sep 30, 2016

@a11smiles what OS are you on? Here is me not being able to reproduce it by opening an Electron app with VS Code on Mac:

screen shot 2016-09-30 at 07 36 12

@bpasero
Copy link
Member

bpasero commented Sep 30, 2016

Extracted #13076

@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug upstream Issue identified as 'upstream' component related (exists outside of VS Code) verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

9 participants