[PR #4724] [CLOSED] normalize command line arguments #25902

Open
opened 2026-01-31 09:12:32 +00:00 by claunia · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/microsoft/terminal/pull/4724
Author: @german-one
Created: 2/26/2020
Status: Closed

Base: masterHead: dev/german_one/cmdargs


📝 Commits (7)

  • cafc0e4 normalize command line arguments
  • 10271d9 PR feedback
  • 0d17690 missing parentheses
  • 6a0eba9 rely on getting the app name as the first argument
  • 0136af8 treat a pair of consecutive quotation marks as a single quotation mark
  • 820c47b add fallthrough attribute
  • e5293a5 Merge remote-tracking branch 'upstream/master' into dev/german_one/cmdargs

📊 Changes

2 files changed (+99 additions, -24 deletions)

View changed files

📝 src/cascadia/WindowsTerminal/AppHost.cpp (+98 -24)
📝 src/cascadia/WindowsTerminal/AppHost.h (+1 -0)

📄 Description

Summary of the Pull Request

Use "" instead of treating \" as escaped ".
Try to ensure that the app name is always the argument with index 0. obsolet

References

#4632

PR Checklist

  • Closes #4571 (Closes #4170 in terms of having the decision that we don't try to resolve it programmatically)
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • Requires documentation to be updated
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx

Detailed Description of the Pull Request / Additional comments

  • Parse the command line and tokenize it using an algorithm that treats "" rather than \" as escaped quotation mark to preserve it in the argument
  • Check if at least one command line argument has been received. Check if the first argument is reasonable to represent the own call. If either of these isn't true, add the app path as first argument. obsolet

Validation Steps Performed

  • Manually called WT with option -d and quoted paths with trailing backslash.
  • Used the CreateProcess function in a test app to simulate the missing application name in the first argument.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/microsoft/terminal/pull/4724 **Author:** [@german-one](https://github.com/german-one) **Created:** 2/26/2020 **Status:** ❌ Closed **Base:** `master` ← **Head:** `dev/german_one/cmdargs` --- ### 📝 Commits (7) - [`cafc0e4`](https://github.com/microsoft/terminal/commit/cafc0e4c6554c85e28d99cf62bca76aeb488f2b5) normalize command line arguments - [`10271d9`](https://github.com/microsoft/terminal/commit/10271d93c6085e0f39e23e48ef6ea53c739bd9f3) PR feedback - [`0d17690`](https://github.com/microsoft/terminal/commit/0d176901cf641edf31e453cc9fda174a8cd5425b) missing parentheses - [`6a0eba9`](https://github.com/microsoft/terminal/commit/6a0eba958aa3a0c214bc36485dc06f17a7472267) rely on getting the app name as the first argument - [`0136af8`](https://github.com/microsoft/terminal/commit/0136af8570bee18b611d92af91bcf15fcde728f1) treat a pair of consecutive quotation marks as a single quotation mark - [`820c47b`](https://github.com/microsoft/terminal/commit/820c47bd7c343fd17810848e018687c42a343d29) add [[fallthrough]] attribute - [`e5293a5`](https://github.com/microsoft/terminal/commit/e5293a5fe0e99e7045485cc00621d8f4f6a7a479) Merge remote-tracking branch 'upstream/master' into dev/german_one/cmdargs ### 📊 Changes **2 files changed** (+99 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `src/cascadia/WindowsTerminal/AppHost.cpp` (+98 -24) 📝 `src/cascadia/WindowsTerminal/AppHost.h` (+1 -0) </details> ### 📄 Description <!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request Use `""` instead of treating `\"` as escaped `"`. ~Try to ensure that the app name is always the argument with index 0.~ *obsolet* <!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> ## References #4632 <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes #4571 (Closes #4170 in terms of having the decision that we don't try to resolve it programmatically) * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [x] Tests added/passed * [ ] Requires documentation to be updated * [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx <!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments - Parse the command line and tokenize it using an algorithm that treats `""` rather than `\"` as escaped quotation mark to preserve it in the argument - ~Check if at least one command line argument has been received. Check if the first argument is reasonable to represent the own call. If either of these isn't true, add the app path as first argument.~ *obsolet* <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed - Manually called WT with option `-d` and quoted paths with trailing backslash. - Used the `CreateProcess` function in a test app to simulate the missing application name in the first argument. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
claunia added the pull-request label 2026-01-31 09:12:32 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#25902