diff --git a/lib/bundle/vscode_extension_installer.rb b/lib/bundle/vscode_extension_installer.rb index 85150baa47..1fcb74e465 100644 --- a/lib/bundle/vscode_extension_installer.rb +++ b/lib/bundle/vscode_extension_installer.rb @@ -30,7 +30,15 @@ def install(name, preinstall: true, no_upgrade: false, verbose: false, force: fa puts "Installing #{name} VSCode extension. It is not currently installed." if verbose - return false unless Bundle.system "code", "--install-extension", name, verbose: verbose + install_extension = proc do + Bundle.system("code", "--install-extension", name, verbose:) + end + success = if Process.euid == Process.uid + install_extension.call + else + Process::UID.switch(&install_extension) + end + return false unless success installed_extensions << name