Skip to content

Commit

Permalink
main.c: Implement open in other terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
yuk7 committed Mar 24, 2020
1 parent e05e5d9 commit 1238295
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,33 @@ int main()
{
if(wargc == 1)
{
SetConsoleTitleW(TargetName);
hr = WslLaunchInteractive(TargetName,L"", false, &exitCode);
if (wslInstallation.termInfo == 1) //Windows Terminal
{
wchar_t Ecmd[200] = L"wt.exe \"";
wcscat_s(Ecmd, ARRAY_LENGTH(Ecmd), efpath);
wcscat_s(Ecmd, ARRAY_LENGTH(Ecmd), L"\" run");

FreeConsole();
STARTUPINFOW si = {0};
PROCESS_INFORMATION pi = {0};
return CreateProcessW(NULL, Ecmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
}
else if (wslInstallation.termInfo == 2) //Fluent Terminal
{
wchar_t Ecmd[200] = L"flute.exe run \"";
wcscat_s(Ecmd, ARRAY_LENGTH(Ecmd), efpath);
wcscat_s(Ecmd, ARRAY_LENGTH(Ecmd), L" run\"");

FreeConsole();
STARTUPINFOW si = {0};
PROCESS_INFORMATION pi = {0};
return CreateProcessW(NULL, Ecmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
}
else
{
SetConsoleTitleW(TargetName);
hr = WslLaunchInteractive(TargetName,L"", false, &exitCode);
}
}
else //run with arguments
{
Expand Down

0 comments on commit 1238295

Please sign in to comment.