Skip to content

Commit 0237e4b

Browse files
bzozarjunbalgovind
authored andcommitted
Runner: fix restarting with same elevation (#1133)
1 parent 7bb03cb commit 0237e4b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/common/common.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ bool run_elevated(const std::wstring& file, const std::wstring& params) {
248248
}
249249

250250
bool run_non_elevated(const std::wstring& file, const std::wstring& params) {
251-
auto executable_args = file;
251+
auto executable_args = L"\"" + file + L"\"";
252252
if (!params.empty()) {
253253
executable_args += L" " + params;
254254
}
@@ -311,7 +311,7 @@ bool run_non_elevated(const std::wstring& file, const std::wstring& params) {
311311
}
312312

313313
bool run_same_elevation(const std::wstring& file, const std::wstring& params) {
314-
auto executable_args = file;
314+
auto executable_args = L"\"" + file + L"\"";
315315
if (!params.empty()) {
316316
executable_args += L" " + params;
317317
}

src/runner/restart_elevated.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,5 @@ bool restart_same_elevation()
4747
constexpr DWORD exe_path_size = 0xFFFF;
4848
auto exe_path = std::make_unique<wchar_t[]>(exe_path_size);
4949
GetModuleFileNameW(nullptr, exe_path.get(), exe_path_size);
50-
return run_same_elevation(exe_path.get(), {});
50+
return run_same_elevation(exe_path.get(), L"--dont-elevate");
5151
}

0 commit comments

Comments
 (0)