Don't copy the environment to update it
This causes problems on windows, and is wasteful anyway. The subprocess will pick up the environment from its parent.
This commit is contained in:
parent
573121ee08
commit
8261cde3c9
5 changed files with 38 additions and 14 deletions
|
|
@ -740,11 +740,7 @@ class DebugSession( object ):
|
||||||
|
|
||||||
self._connection_type = self._api_prefix + self._connection_type
|
self._connection_type = self._api_prefix + self._connection_type
|
||||||
|
|
||||||
# TODO: Do we actually need to copy and update or does Vim do that?
|
self._adapter[ 'env' ] = self._adapter.get( 'env', {} )
|
||||||
env = os.environ.copy()
|
|
||||||
if 'env' in self._adapter:
|
|
||||||
env.update( self._adapter[ 'env' ] )
|
|
||||||
self._adapter[ 'env' ] = env
|
|
||||||
|
|
||||||
if 'cwd' not in self._adapter:
|
if 'cwd' not in self._adapter:
|
||||||
self._adapter[ 'cwd' ] = os.getcwd()
|
self._adapter[ 'cwd' ] = os.getcwd()
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,20 @@
|
||||||
{
|
{
|
||||||
"configurations": {
|
"configurations": {
|
||||||
"simple_c_program - Launch": {
|
"CodeLLDB": {
|
||||||
"adapter": "CodeLLDB",
|
"adapter": "CodeLLDB",
|
||||||
"configuration": {
|
"configuration": {
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"program": "${workspaceRoot}/test",
|
"program": "${workspaceRoot}/test",
|
||||||
"stopAtEntry": true
|
"stopAtEntry": true
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"lldb-vscode": {
|
||||||
|
"adapter": "lldb-vscode",
|
||||||
|
"configuration": {
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceRoot}/test",
|
||||||
|
"stopAtEntry": true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <cstdio>
|
||||||
|
#include <cstdlib>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
namespace Test
|
namespace Test
|
||||||
|
|
@ -33,6 +35,8 @@ int main ( int argc, char ** argv )
|
||||||
{
|
{
|
||||||
int x{ 10 };
|
int x{ 10 };
|
||||||
|
|
||||||
|
printf( "HOME: %s\n", getenv( "HOME" ) );
|
||||||
|
|
||||||
Test::TestStruct t{ true, {99} };
|
Test::TestStruct t{ true, {99} };
|
||||||
foo( t );
|
foo( t );
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,12 @@
|
||||||
{
|
{
|
||||||
"$schema": "https://puremourning.github.io/vimspector/schema/vimspector.schema.json",
|
"$schema": "https://puremourning.github.io/vimspector/schema/vimspector.schema.json",
|
||||||
"adapters": {
|
"adapters": {
|
||||||
"test_custom": {
|
"run_with_debugpy": {
|
||||||
"command": "This is a test"
|
"command": [ "${workspaceRoot}/run_with_debugpy" ],
|
||||||
|
"port": 9876,
|
||||||
|
"env": {
|
||||||
|
"DEBUG_PORT": "9876"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"configurations": {
|
"configurations": {
|
||||||
|
|
@ -44,6 +48,19 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"attach-run": {
|
||||||
|
"adapter": "run_with_debugpy",
|
||||||
|
"configuration": {
|
||||||
|
"request": "attach"
|
||||||
|
},
|
||||||
|
"breakpoints": {
|
||||||
|
"exception": {
|
||||||
|
"raised": "N",
|
||||||
|
"uncaught": "",
|
||||||
|
"userUnhandled": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"run": {
|
"run": {
|
||||||
"adapter": "debugpy",
|
"adapter": "debugpy",
|
||||||
"configuration": {
|
"configuration": {
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
PYTHON=python3
|
if [ -z "$DEBUG_PORT" ]; then
|
||||||
|
DEBUG_PORT=5678
|
||||||
if [ -n "$1" ]; then
|
|
||||||
PYTHON=$1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pushd $(dirname $0)
|
pushd $(dirname $0)
|
||||||
|
|
@ -11,10 +9,11 @@ pushd $(dirname $0)
|
||||||
rm -rf env
|
rm -rf env
|
||||||
fi
|
fi
|
||||||
|
|
||||||
$PYTHON -m venv env
|
python3 -m venv env
|
||||||
. env/bin/activate
|
. env/bin/activate
|
||||||
python -m pip install -r requirements.txt
|
python -m pip install -r requirements.txt
|
||||||
|
echo "using port $DEBUG_PORT"
|
||||||
echo "*** Launching ***"
|
echo "*** Launching ***"
|
||||||
python -m debugpy --wait-for-client --listen 0.0.0.0:5678 main.py
|
python -m debugpy --wait-for-client --listen 0.0.0.0:${DEBUG_PORT} main.py
|
||||||
popd
|
popd
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue