From f1859639d72c0ca9f38ae95a6db607ac7f41e08b Mon Sep 17 00:00:00 2001 From: Ben Jackson Date: Fri, 1 Feb 2019 10:05:16 +0000 Subject: [PATCH] Alow env and cwd to be specified for the _adapter_ --- autoload/vimspector/internal/job.vim | 2 ++ python3/vimspector/debug_session.py | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/autoload/vimspector/internal/job.vim b/autoload/vimspector/internal/job.vim index 1a61a2b..4f30ebf 100644 --- a/autoload/vimspector/internal/job.vim +++ b/autoload/vimspector/internal/job.vim @@ -76,6 +76,8 @@ function! vimspector#internal#job#StartDebugSession( config ) abort \ 'out_cb': funcref( 's:_OnServerData' ), \ 'err_cb': funcref( 's:_OnServerError' ), \ 'stoponexit': 'term', + \ 'env': a:config[ 'env' ], + \ 'cwd': a:config[ 'cwd' ], \ } \ ) diff --git a/python3/vimspector/debug_session.py b/python3/vimspector/debug_session.py index 34f438e..15f5bf6 100644 --- a/python3/vimspector/debug_session.py +++ b/python3/vimspector/debug_session.py @@ -368,6 +368,15 @@ class DebugSession( object ): port = utils.AskForInput( 'Enter port to connect to: ' ) self._adapter[ 'port' ] = port + # TODO: Do we actually need to copy and update or does Vim do that? + env = os.environ.copy() + if 'env' in self._adapter: + env.update( self._adapter[ 'env' ] ) + self._adapter[ 'env' ] = env + + if 'cwd' not in self._adapter: + self._adapter[ 'cwd' ] = os.getcwd() + channel_send_func = vim.bindeval( "vimspector#internal#{}#StartDebugSession( {} )".format( self._connection_type,