Open Interesting6 opened 3 years ago
Maybe the error is not caused by zsh escape mechanism.
For example, the input is:
[3,5,1,6,2,0,8,null,null,7,4]\n5\n1
But by 5 and 1, they are both a tree node, in leecode question 236.
I see the source code, it is essential to use a list-like object to construct a tree node, instead of an integer.
So I just change the input to:
[3,5,1,6,2,0,8,null,null,7,4]\n[5]\n[1]
which works well.
🐛 Bug Report
when the input occupied more than one line, all input lines will transform into one line connected by
"\n"
as asys.stdin
. And then that converts to a shell command. However, the\n
in command turns out to be\\n
in macOS zsh environment, which cause a Parameters parsing error.当输入为多行时,输入会被转化为一行以"\n"连接的字符串,但在debug时,在macOS的zsh中,
\n
会被转化为\\n
,导致了参数解析错误。Expected behavior
Normal
Extension Output
cd /Users/treamy/Codes/Algorithms/LeetCode ; /usr/bin/env /usr/local/bin/python3 /Users/treamy/.vscode/extensions/ms-python.python-2021.2.582707922/pythonFiles/lib/python/debugpy/launcher 49611 -- "/Users/treamy/Library/Application Support/Code/User/globalStorage/wangtao0101.debug-leetcode/python3problem236.py" /Users/treamy/Codes/Algorithms/LeetCode/236. 二叉树的最近公共祖先.py [3,5,1,6,2,0,8,null,null,7,4]\\n5\\n1 lowestCommonAncestor TreeNode,TreeNode,TreeNode TreeNode 236 52013
Guidance: Press
Ctrl+Shift+U
, and toggle the channel toDebug LeetCode
.Your Environment