Skip to content

Commit d56f0a0

Browse files
committed
Improve process information handler
1 parent 50a8e88 commit d56f0a0

File tree

2 files changed

+31
-6
lines changed

2 files changed

+31
-6
lines changed

Flow.Launcher.Command/Program.cs

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,43 @@ private static int Main(string[] args)
7171

7272
try
7373
{
74-
using var process = new Process
74+
ProcessStartInfo info;
75+
if (argumentList.Count == 0)
7576
{
76-
StartInfo = new ProcessStartInfo
77+
info = new ProcessStartInfo
7778
{
7879
FileName = fileName,
7980
WorkingDirectory = workingDirectory,
80-
Arguments = string.Join(" ", argumentList),
8181
UseShellExecute = useShellExecute,
8282
Verb = verb
83+
};
84+
}
85+
else if (argumentList.Count == 1)
86+
{
87+
info = new ProcessStartInfo
88+
{
89+
FileName = fileName,
90+
WorkingDirectory = workingDirectory,
91+
Arguments = argumentList[0],
92+
UseShellExecute = useShellExecute,
93+
Verb = verb
94+
};
95+
}
96+
else
97+
{
98+
info = new ProcessStartInfo
99+
{
100+
FileName = fileName,
101+
WorkingDirectory = workingDirectory,
102+
UseShellExecute = useShellExecute,
103+
Verb = verb
104+
};
105+
foreach (var arg in argumentList)
106+
{
107+
info.ArgumentList.Add(arg);
83108
}
84-
};
85-
process.Start();
109+
}
110+
Process.Start(info)?.Dispose();
86111
Console.WriteLine("Success.");
87112
return 0;
88113
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ bool API_GlobalKeyboardEvent(int keyevent, int vkcode, SpecialKeyState state)
389389
return true;
390390
}
391391

392-
private void OnWinRPressed()
392+
private static void OnWinRPressed()
393393
{
394394
Context.API.ShowMainWindow();
395395
// show the main window and set focus to the query box

0 commit comments

Comments
 (0)