cli icon indicating copy to clipboard operation
cli copied to clipboard

devcontainers cli hangs (Windows 11)

Open sangrepura opened this issue 1 year ago • 5 comments

Steps to reproduce: Install VSCode (latest stable) Install Dev Containers plugin (stable or prerelease) Open command palette and install devcontainers CLI

Run cli: (HANGS)

devcontainer.cmd --version (_HANGS_)
^CTerminate batch job (Y/N)? Y

(HANGS)

devcontainer.cmd --help 
^CTerminate batch job (Y/N)? Y

I uninstalled and reinstalled both the stable and pre-release versions: Dev Containers v0.304.0 Dev Containers v0.305

deleting: C:\Users\$USER\AppData\Roaming\Code\User\globalStorage\\ms-vscode-remote.remote-containers each time

CLI is broken and unusable.

sangrepura avatar Aug 20 '23 23:08 sangrepura

Hi 👋

Thanks for opening the issue!

devcontainer.cmd --help

@codementation shouldn't the command be 👇 ? Interesting, I have never tried to use devcontainer.cmd before.

devcontainer --help

samruddhikhandale avatar Aug 21 '23 23:08 samruddhikhandale

@samruddhikhandale thanks for the quick reply.

So devcontainer cli in Windows is installed by the plugin and added to the $PATH as a symlink to devcontainer.cmd:

Get-Command  devcontainer | Format-table -AutoSize

CommandType Name             Version Source
----------- ----             ------- ------
Application devcontainer.cmd 0.0.0.0 c:\Users\$USER\AppData\Roaming\Code\User\globalStorage\ms-vscode-remote.remote-containers\cli-bin\devcontainer.cmd

devcontainer --help also hangs:

devcontainer --help
^CTerminate batch job (Y/N)? Y

sangrepura avatar Aug 22 '23 14:08 sangrepura

I peeked at the devcontainers.cmd file and these are the contents. Not sure if this information helps:

@echo off
@REM This file is placed in a stable (version-independent) location
@REM and forwards to the currently installed version

setlocal
SET DEVCONTAINER_CLI_PATH=%~f0
SET VSCODE_PATH=

:vscode_path
@REM Load the Code.exe path
IF NOT exist "%~dp0vscode-path%" goto fail_vscode_path
set /p VSCODE_PATH=<"%~dp0vscode-path%"
IF exist "%VSCODE_PATH%" goto remote_container_path

:fail_vscode_path
echo Failed to determine VS Code path
exit 1

:remote_container_path

SET REMOTE_CONTAINERS_PATH=

@REM Check the remote-containers-path file
@REM This is a cache (and enables Dev Containers development)
IF NOT exist "%~dp0remote-containers-path%" goto fail_remote_container_path
set /p REMOTE_CONTAINERS_PATH=<"%~dp0remote-containers-path%"
IF exist "%REMOTE_CONTAINERS_PATH%\dev-containers-user-cli\cli.js" goto forwardcall

:fail_remote_container_path
echo Failed to determine Dev Containers path
exit 1

:forwardcall
set ELECTRON_RUN_AS_NODE=1
"%VSCODE_PATH%" --ms-enable-electron-run-as-node "%REMOTE_CONTAINERS_PATH%\dev-containers-user-cli\\cli.js" %*

endlocal

sangrepura avatar Aug 22 '23 15:08 sangrepura

So I tried VSCode Insiders and it works:

devcontainer-insiders.cmd --help
devcontainer <command>

Commands:
  devcontainer open [path]          Open a dev container in VS Code
  devcontainer up                   Create and run dev container
  devcontainer set-up               Set up an existing container as a dev container
  devcontainer build [path]         Build a dev container image
  devcontainer run-user-commands    Run user commands
  devcontainer read-configuration   Read configuration
  devcontainer outdated             Show current and available versions
  devcontainer features             Features commands
  devcontainer templates            Templates commands
  devcontainer exec <cmd> [args..]  Execute a command on a running dev container

Options:
  --help     Show help  [boolean]
  --version  Show version number  [boolean]

[email protected] c:\Users\$USER\.vscode-insiders\extensions\ms-vscode-remote.remote-containers-0.306.0

However even after completely uninstalling VSCode Stable, removing ~/.vscode and C:\Users\$USER\AppData\Roaming\Code\ and reinstalling the cli hangs still.

sangrepura avatar Aug 22 '23 19:08 sangrepura

I wonder if it's related to https://github.com/microsoft/vscode-remote-release/issues/8738? If that's the case, @codementation can you report your findings in that issue? thanks!

samruddhikhandale avatar Aug 25 '23 23:08 samruddhikhandale