vscode icon indicating copy to clipboard operation
vscode copied to clipboard

Allow to open different windows with different permissions

Open MullenStudio opened this issue 10 years ago • 86 comments

  • VSCode Version: 1.1.1
  • OS Version: Windows 10 1511 (10586.318)

Steps to Reproduce:

  1. Close all Code instances, then run Code as administrator (a new blank Code instance with administrator right)
  2. In File Explorer, right click a text file and Open with Code, nothing will happen.

Note: there are multiple other ways to trigger this issue, the above repro is just an example. Note 2: If you already have a code instance running without administrator running, the above issue will not get triggered. That's why the very first step is to close all Code instances.

MullenStudio avatar May 19 '16 22:05 MullenStudio

I would say this is impossible today given our process architecture.

bpasero avatar May 24 '16 08:05 bpasero

Why is this impossible? Is there a way to make it possible?

StarTether avatar Feb 16 '17 21:02 StarTether

Would it be possible to include the elevation status in the pipe name so there are two parallel pipes for elevated and non-elevated processes?

rainersigwald avatar Mar 20 '17 14:03 rainersigwald

Hi. If you try to open a file in VS Code from command line using -r option to reuse existing window still fails if you have opened it using admin rights.

DfernandezNipo avatar Jun 02 '17 09:06 DfernandezNipo

Opening VS Code as elevated administrator in Windows. Then open an elevated PowerShell prompt and movide to a folder, then issue code . will open the folder in VS Code in a new window. But if the PowerShell prompt is not elevated this does not work. I was expecting it to open in a new window, but not elevated.

johlju avatar Jun 06 '17 09:06 johlju

I didn't remember if my last code window was opened as admin and I was unable to open a new window running code . until I read this issue. Is there a way to know that code is running in admin mode? I don't see it on the title bar.

demali avatar Oct 16 '17 23:10 demali

The workaround for this is to force code to always run as administrator by right clicking on the exe, going to Properties, clicking on the Compatibility tab and check the box labeled "Run this program as an administrator".

ryansimmen avatar Dec 20 '17 15:12 ryansimmen

When there is no vscode process running, if you first open a file/folder as:

  • non-admin, then open as admin, then non-admin again.. it works
  • admin, then open as non-admin, it chokes with the error

The error is coming from:

https://github.com/Microsoft/vscode/blob/397b45b76dba2e9f0520664d1527b3d526fe4ae7/src/vs/code/electron-main/main.ts#L226-L233

In case of EPERM, should it try to launch a new process? The code above this line would need to be changed to support array PIDs.

ghost avatar Apr 01 '18 19:04 ghost

Maybe we should look at other electron-based apps, how they are handling multiple instances on windows and fix this issue. This is hurting the user experience. I had a demo effect with this one, which silenced the audience who were otherwise applauding the use of VSCode and it's code path/to/file shortcut..

ghost avatar Apr 01 '18 19:04 ghost

This just happenned to me as well. "A second instance of Code is already running as administrator".

Baffling that this happens. Posting it just to update the date on the thread that the issue is still around. Running on Windows 7 x64 (Powershell 3.0) using Code version 1.21.1

spakh avatar Apr 06 '18 13:04 spakh

+1 also happening to me. I'm confused by this thread. Is this behavior by-design or incorrect? I figure a text editor should be able to have as many instances as I want.

brandonchastain avatar Apr 17 '18 18:04 brandonchastain

+1 also happening to me. Seems to be dependent on OS and UAC settings.

flupkede avatar Apr 18 '18 18:04 flupkede

I'm curious what the status is on this? There are numerous other reports of this - all of them being closed as a dupe (some with links back to this, others with no links). I see this has been open for 2 years

kbrowns avatar Apr 25 '18 14:04 kbrowns

Anyone looking at this?

justin-romano avatar May 14 '18 00:05 justin-romano

I have only just started experiencing this problem since a recent update. Not sure if it was the recent windows creators update that has changed things or if it was a release of vscode. I don't specifically run as admin for the first copy, it seems to do it for itself, and then decides not to when I want to open a second file.

For now a sort of workaround, as mentioned above, is that I have set "run as admin" in the .exe properties, but this means I now have to click the yes prompt every time I open vscode.

When it does open, it opens into the same copy of vscode thats running, not a second instance.

rtpHarry avatar May 16 '18 04:05 rtpHarry

Looking at the other highest voted issues being ignored by @bpasero and co., such as https://github.com/Microsoft/vscode/issues/10121, it doesn't seem like they care much. Even the pull requests are sitting there unmerged without any explanation for months/years.. Why would anyone spend time to fix this issue, open a pull-request and get ignored for the rest of my life? This project need serious love and better maintainers.

ghost avatar May 16 '18 04:05 ghost

@kasper3 The workaround, as mentioned above (https://github.com/Microsoft/vscode/issues/6560#issuecomment-353100020) is to force vscode to always open as admin. There are clearly technical issues behind why this and #10121 haven't been implemented yet. It's definitely not true that the maintainers don't care.

brownbl1 avatar May 21 '18 12:05 brownbl1

Run this program as an administrator works for me.

image

earthday avatar Jun 12 '18 02:06 earthday

This does not help for using the shell menu. That's the really annoying thing. Even if the shell menu elevated the session through UAC

On Tue, Jun 12, 2018 at 2:09 PM, Bright Chen [email protected] wrote:

Run this program as an administrator works for me. [image: image] https://user-images.githubusercontent.com/90078/41266204-82ca3368-6e28-11e8-8e88-a2e0d37a4cd8.png

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/Microsoft/vscode/issues/6560#issuecomment-396442643, or mute the thread https://github.com/notifications/unsubscribe-auth/ABoM2j9K5vRAe0E_oAM0L7hEBhbTzg-Nks5t7yLQgaJpZM4IivsR .

-- Justin Romaine Senior Systems Architect Spark Dental Technology [email protected] ph 021 764 506 hm 09 445 9166

justin-romano avatar Jun 12 '18 02:06 justin-romano

I know that running always as Administrator is a Microsoft tradition to solve some problems, but I want to run it with the minimum permissions that the program needs each time.

DfernandezNipo avatar Jun 12 '18 06:06 DfernandezNipo