dapr / cli

Command-line tools for Dapr.
Apache License 2.0
315 stars 197 forks source link

Fix for Quote in username errors dapr init #972 #1322

Closed mohitpalsingh closed 1 year ago

mohitpalsingh commented 1 year ago

Description

dapr init fails to run with certain username on Windows. This issue was caused because of an extra apostrophe or single quote in the username since powershell considers it as special character and hence creates syntax issues. To solve this, I created a function in '/utils/utils.go' to take any command and converts into powershell compatible command by appending another quote character after every such character. This makes the command powershell compatible. Now it doesn't throw any syntax error and runs as expected.

Closes #972

Testing

PS C:\Users\Carlin'tVeld> cd D: PS D:> .\dapr.exe init Making the jump to hyperspace... Container images will be pulled from Docker Hub Installing runtime version 1.11.1 Downloading binaries and setting up components... Downloaded binaries and completed components set up. daprd binary has been installed to C:\Users\Carlin'tVeld.dapr\bin. dapr_placement container is running. dapr_redis container is running. dapr_zipkin container is running. Use docker ps to check running containers. Success! Dapr is up and running. To get started, go here: https://aka.ms/dapr-getting-started PS D:>

mohitpalsingh commented 1 year ago

@mohitpalsingh thanks for the contribution. Can you add unit tests for this?

yes sure. Will do that tomorrow.

codecov[bot] commented 1 year ago

Codecov Report

Merging #1322 (0c45ce1) into master (a4f924f) will decrease coverage by 0.01%. The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master    #1322      +/-   ##
==========================================
- Coverage   26.82%   26.81%   -0.01%     
==========================================
  Files          39       39              
  Lines        3881     3882       +1     
==========================================
  Hits         1041     1041              
- Misses       2766     2767       +1     
  Partials       74       74              
Impacted Files Coverage Δ
pkg/standalone/standalone.go 4.46% <0.00%> (-0.01%) :arrow_down:
mohitpalsingh commented 1 year ago

Thanks @mohitpalsingh for your first contribution, can you just fix the lint failure, overall PR LGTM.

Thank you for the feedback and acknowledging my contribution. I appreciate your support. I have addressed the lint failure and made the necessary fixes. Your approval of the overall pull request means a lot to me. Thank you once again for your time and guidance.