Skip to content

Fix time command losing quoted arguments when re-parsing#286

Open
wolfv wants to merge 1 commit intomainfrom
claude/fix-torch-import-xnWN5
Open

Fix time command losing quoted arguments when re-parsing#286
wolfv wants to merge 1 commit intomainfrom
claude/fix-torch-import-xnWN5

Conversation

@wolfv
Copy link
Member

@wolfv wolfv commented Mar 24, 2026

Summary

  • The time builtin joined its arguments with args.join(" ") and re-parsed the result, which destroyed all quoting information
  • time python -c "import torch" would pass just import to Python (truncating the argument)
  • time python -c "print('ok')" would fail with a shell parse error due to unquoted parentheses
  • Fix: shell-quote arguments containing whitespace or special characters (using single-quote wrapping) before joining and re-parsing

Test plan

  • Added time_preserves_quoted_args test covering double-quoted args, single-quoted args, and args with special characters like parentheses
  • All existing tests pass

https://claude.ai/code/session_01PQyPNXA8mZKTLkNfytRunv

The `time` builtin joined its arguments with spaces and re-parsed them,
which destroyed quoting information. For example, `time python -c "import torch"`
would pass just `import` to Python instead of `import torch`, and
`time python -c "print('ok')"` would fail to parse due to unquoted parentheses.

Fix by shell-quoting arguments that contain whitespace or special characters
before joining and re-parsing.

https://claude.ai/code/session_01PQyPNXA8mZKTLkNfytRunv
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

Successfully merging this pull request may close these issues.

2 participants