Skip to content

Commit 9b894b3

Browse files
committed
update comment regarding usage of Argument vs ArgumentList
1 parent b11e574 commit 9b894b3

File tree

1 file changed

+15
-4
lines changed
  • Plugins/Flow.Launcher.Plugin.Shell

1 file changed

+15
-4
lines changed

Plugins/Flow.Launcher.Plugin.Shell/Main.cs

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,18 +194,29 @@ private ProcessStartInfo PrepareProcessStartInfo(string command, bool runAsAdmin
194194

195195
ProcessStartInfo info = new()
196196
{
197-
Verb = runAsAdministratorArg, WorkingDirectory = workingDirectory,
197+
Verb = runAsAdministratorArg,
198+
WorkingDirectory = workingDirectory,
198199
};
199200
switch (_settings.Shell)
200201
{
201202
case Shell.Cmd:
202203
{
203204
info.FileName = "cmd.exe";
204205
info.Arguments = $"{(_settings.LeaveShellOpen ? "/k" : "/c")} {command}";
205-
206-
// ArgumentList may break original shell command separation with quote.
206+
207+
//// Use info.Arguments instead of info.ArgumentList to enable user better control over the argument they are writing.
208+
//// Previous code using ArgumentList, commands needed to be seperated correctly:
209+
//// Incorrect:
207210
// info.ArgumentList.Add(_settings.LeaveShellOpen ? "/k" : "/c");
208-
// info.ArgumentList.Add(command);
211+
// info.ArgumentList.Add(command); //<== info.ArgumentList.Add("mkdir \"c:\\test new\"");
212+
213+
//// Correct version should be:
214+
//info.ArgumentList.Add(_settings.LeaveShellOpen ? "/k" : "/c");
215+
//info.ArgumentList.Add("mkdir");
216+
//info.ArgumentList.Add(@"c:\test new");
217+
218+
//https://docs.microsoft.com/en-us/dotnet/api/system.diagnostics.processstartinfo.argumentlist?view=net-6.0#remarks
219+
209220
break;
210221
}
211222

0 commit comments

Comments
 (0)