[patch] Add support for passing args to the debugged script (python)
未关闭
- 主要语言
- Python
- 星标
- 284
- 派生
- 27
- PR 合并指标
- 30 天内没有已合并 PR
描述
Example:
:Dbg ". hello world"
Executes the current script with "hello world" as arguments.
Patch supplied:
diff -Naur orig//commands.py new//commands.py
--- orig//commands.py 2011-01-27 13:19:39.366748310 -0300
+++ new//commands.py 2011-01-27 13:17:35.066748310 -0300
@@ -62,7 +62,7 @@
if debugger and debugger.started:
return
if url is not None:
- if url in ('.', '-'):
+ if url[0] in ('.', '-'):
pass
elif url.isdigit():
urls = load_urls()
@@ -81,11 +81,11 @@
debugger.init_vim()
global _commands
_commands = debugger.commands()
- if url == '.':
+ if url[0] == '.':
if not (os.path.exists(fname) and fname.endswith('.py')):
print 'Current file is not python (or doesn\'t exist on your hard drive)'
return
- debugger.start_py(fname)
+ debugger.start_py(fname + url[1:])
elif url == '-':
debugger.start()
else:
diff -Naur orig//new_debugger.py new//new_debugger.py
--- orig//new_debugger.py 2011-01-27 13:19:47.722748309 -0300
+++ new//new_debugger.py 2011-01-27 13:21:15.702748310 -0300
@@ -113,7 +113,7 @@
return self.start()
def start_py(self, fname):
- subprocess.Popen(('pydbgp.py', '-d', 'localhost:9000', fname), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ subprocess.Popen(('pydbgp.py', '-d', 'localhost:9000') + tuple(fname.split()), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
self._type = 'python'
return self.start()
贡献指南
这个仓库没有索引到贡献指南
调研方向
先从 commands.py 中的 :Dbg 处理和 new_debugger.py 中的 start_py 入口点开始,然后将提供的补丁与当前文件进行比较。确认示例调用会使用所请求的参数运行当前 Python 脚本,并且现有的调试器行为保持不变。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- python
- 领域
- devtools
- Issue 类型
- 功能
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 35/100