Skip to content

Commit 89214fb

Browse files
committed
Improve code quality
1 parent 07f4407 commit 89214fb

File tree

1 file changed

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

1 file changed

+10
-4
lines changed

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ private ProcessStartInfo PrepareProcessStartInfo(string command, bool runAsAdmin
200200
WorkingDirectory = workingDirectory,
201201
};
202202
var notifyStr = Context.API.GetTranslation("flowlauncher_plugin_cmd_press_any_key_to_close");
203+
var addedCharacter = _settings.UseWindowsTerminal ? "\\" : "";
203204
switch (_settings.Shell)
204205
{
205206
case Shell.Cmd:
@@ -213,9 +214,16 @@ private ProcessStartInfo PrepareProcessStartInfo(string command, bool runAsAdmin
213214
{
214215
info.FileName = "cmd.exe";
215216
}
216-
217+
if (_settings.LeaveShellOpen)
218+
{
219+
info.ArgumentList.Add("/k");
220+
}
221+
else
222+
{
223+
info.ArgumentList.Add("/c");
224+
}
217225
info.ArgumentList.Add(
218-
$"{(_settings.LeaveShellOpen ? "/k" : "/c")} {command}" +
226+
$"{command}" +
219227
$"{(_settings.CloseShellAfterPress ?
220228
$" && echo {notifyStr} && pause > nul /c" :
221229
"")}");
@@ -226,7 +234,6 @@ private ProcessStartInfo PrepareProcessStartInfo(string command, bool runAsAdmin
226234
{
227235
// Using just a ; doesn't work with wt, as it's used to create a new tab for the terminal window
228236
// \\ must be escaped for it to work properly, or breaking it into multiple arguments
229-
var addedCharacter = _settings.UseWindowsTerminal ? "\\" : "";
230237
if (_settings.UseWindowsTerminal)
231238
{
232239
info.FileName = "wt.exe";
@@ -257,7 +264,6 @@ private ProcessStartInfo PrepareProcessStartInfo(string command, bool runAsAdmin
257264
{
258265
// Using just a ; doesn't work with wt, as it's used to create a new tab for the terminal window
259266
// \\ must be escaped for it to work properly, or breaking it into multiple arguments
260-
var addedCharacter = _settings.UseWindowsTerminal ? "\\" : "";
261267
if (_settings.UseWindowsTerminal)
262268
{
263269
info.FileName = "wt.exe";

0 commit comments

Comments
 (0)