Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"\n" become "\\n" raise a parameters parsing error in mac os zsh commandline #13

Open
Interesting6 opened this issue Mar 7, 2021 · 1 comment

Comments

@Interesting6
Copy link

Interesting6 commented Mar 7, 2021

🐛 Bug Report

when the input occupied more than one line, all input lines will transform into one line connected by "\n" as a sys.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 to Debug LeetCode.

Your Environment

  • python 3.6.5
  • os: macOS
  • extension settings:
  • nodejs version:
  • vscode version: 1.52.1
  • extension version: 0.2.2
@Interesting6
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant