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

xvfb-run wrapper for debug scripts #1163

Closed
jordan-schneider opened this issue Feb 2, 2021 · 9 comments
Closed

xvfb-run wrapper for debug scripts #1163

jordan-schneider opened this issue Feb 2, 2021 · 9 comments

Comments

@jordan-schneider
Copy link

I run code on headless servers using vscode-remote. Because the server is headless in order to get these scripts to run at all, I have to wrap them in xvfb-run. Unfortunately, as far as I can tell I cannot specify in a launch.json that I want to launch the debug run inside of a xvfb-run call. Is there a way to do this currently? If not, I would appreciate the feature.

Probably it would be best to make this some general ability to wrap debug commands in outer bash commands, which would e.g. enable you to nice your debug script, or isolate it to one core using taskset.

@mch5048
Copy link

mch5048 commented Apr 22, 2021

I agree that that feature would be very helpful for robotics researchers working on the remote servers with graphical simulators.

@int19h
Copy link
Contributor

int19h commented Apr 26, 2021

You can use the "python" setting in launch.json to designate a custom Python interpreter. This can be a shell script that wraps the actual interpreter after setting up the environment as needed - the only requirement is that it should respect the same command line options as regular CPython binary (e.g. by delegating them all).

@mch5048
Copy link

mch5048 commented Apr 30, 2021

@int19h Much appreciate for you for your answer. I'm a bit novice at setting a custom interpreter for the shell script. Could you provide us some pointers for writing such code? It would be a great help!

@int19h
Copy link
Contributor

int19h commented May 4, 2021

It depends on your choice of shell. The most basic version for bash should be something like:

#!/bin/bash
python3 "$@"

I'm not familiar with xvfb-run, but it should be straightforward to adapt it to this.

@mch5048
Copy link

mch5048 commented May 5, 2021

@int19h
Now I get what you suggest. Thanks for your help!

@UmarSpa
Copy link

UmarSpa commented May 7, 2021

@mch5048 Can you please share details of your solution?

What changes I need to do in launch.json to debug run inside of a xvfb-run call ?

Edit: Actually I just managed to solve this by using xvfb directly in my script. I used https://github.com/ponty/pyvirtualdisplay/tree/2.1

@mch5048
Copy link

mch5048 commented May 11, 2021

@UmarSpa Actually I tried several ideas to do so, but all attempts failed. :(
However, your solution is working for me like a charm! Thank you for sharing it.

@karrtikr karrtikr transferred this issue from microsoft/vscode-python Dec 21, 2022
@int19h int19h removed their assignment Dec 21, 2022
@int19h int19h closed this as completed Dec 21, 2022
@zichunxx
Copy link

Hi! Is there any way to change the launch.json to debug inside the xvfb-run call instead of installing pyvirtualdisplay?

@Luoji-0
Copy link

Luoji-0 commented Jan 21, 2025

Hi, I also meet the problem, and I find runing command "Xvfb :611 -screen 0 1024x768x16 &" and add "DISPLAY=611" to environment variables before starting dubugging can solve the problem, "611" is the server-num,.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants