-
Notifications
You must be signed in to change notification settings - Fork 17
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
code prints to stderr #118
Comments
I also ran into this somewhere between Ubuntu 20.04 and 23.04, although I'm installing VSCode from Snap so it likely has more to do with the VSCode version and not Ubuntu version. I narrowed it down to the environment variable - role: gantsign.visual-studio-code-extensions
become: true
environment:
# workaround so this role works. VSCode will dump errors without this env var set
# this is a hack as the UID is hard coded. Consider opening a PR upstream
XDG_RUNTIME_DIR: "/run/user/1000"
users:
- username: "{{ ansible_user_id }}"
visual_studio_code_extensions:
- eamodio.gitlens
[...] This is obviously not a robust solution for a few reasons but this should fix it for people if they want a work around. Issues with this fix:
Some thoughts on more robust ways to deal with this:
This role is using |
Why on earth is any STDERR output treated as a hard error? Passing any flags to VSC that are for Chromium/Electron will fail this alone irregardless of RC, so good luck having any global Electron/Chromium configs. If this was implemented because VSC does not always throw an error code on an error, file that upstream, don't try to work around it downstream. [0] % code --ozone-platform=wayland --list-extensions > /dev/null
Warning: 'ozone-platform' is not in the list of known options, but still passed to Electron/Chromium.
[0] % |
Please try to reproduce this on current VSC and extension. If you are able to, please post your full playbook and how you're launching it, output with -vvv (please wrap with Afterwards manually apply #138 and once again post -vvv from that - post it even if that PR fixes your issue, it would be nice to confirm it works fine. Are you sure you need - name: Install Visual Studio Code extensions
ansible.builtin.include_role:
name: gantsign.visual-studio-code-extensions
vars:
visual_studio_code_extensions_build: oss
users:
- username: '{{ username }}'
visual_studio_code_extensions:
- redhat.ansible # Ansible support
- vsciot-vscode.vscode-arduino # Arduino
- ms-vscode.cpptools # C/C++
- hediet.vscode-drawio # Draw.io Integration
- eamodio.gitlens # GitLens
- oderwat.indent-rainbow # ident-rainbow
- timonwong.shellcheck # shellcheck
- simonsiefke.svg-preview # SVG preview
visual_studio_code_extensions_absent:
- simonsiefke.svg-preview # Test removing an already installed thing
- zbr.vscode-ansible # Test removing a thing not installed |
The 'code' command recently started printing the following line to stderr when run through sudo:
mkdir: cannot create directory ‘’: No such file or directory
This can be recreated by executing
sudo -u $USER code --list-extensions
giving the outputThis results in this ansible role failing because of checks like this:
By replacing the condition with
if rc != 0 or (err and 'No such file or directory' not in err):
(and similar for the other places whereerr
is checked) the role works as expected again.I am on Ubuntu 22.04 using the snap version of VS Code.
I just tried to remove the snap version and install the apt version instead (from Microsofts apt repo). The problem disappeared. I will switch to the
visual-studio-code
role instead to get the apt version installed automatically.The text was updated successfully, but these errors were encountered: