在 VSCode 中为 debug 命令添加前缀 [英] Add prefix to debug command in VSCode

查看:75
本文介绍了在 VSCode 中为 debug 命令添加前缀的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在调试 Python 脚本.我的配置看起来像这样:

I'm debugging a Python script. My configuration looks something like this:

{
  "name": "debug script.py",
  "type": "python",
  "request": "launch",
  "program": "/path/to/script.py",
  "console": "integratedTerminal"
}

运行脚本时,我需要在它前面加上一个可执行文件 aws-access 来让自己访问 AWS 上的某些资源(否则我会收到 Permission Denied 错误):

When running the script, I need to prefix it with an executable aws-access to give myself access to certain resources on AWS (otherwise I get Permission Denied errors):

aws-access python script.py

如何将此前缀添加到调试命令中?

How can I add this prefix to the debug command?

请注意,使用 Code Runner 插件:

Note this is easy to do when executing my code using the Code Runner plugin:

"code-runner.executorMap": {
  "python": "aws-access $pythonPath -u $fullFileName"
}

推荐答案

另一种选择是运行:

saml2aws exec --exec-profile [your-profile-name] --session-duration=3600 -- $SHELL

在您的 VS 终端中.在后续调试执行时,您将保持身份验证状态(直至会话持续时间).

in your VS terminal. Upon subsequent debugging executions, you will stay authenticated (up to the session duration).

这篇关于在 VSCode 中为 debug 命令添加前缀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆