Skip to content

Commit 2614675

Browse files
committed
Fix #648; PowerShell on Win8.1 can replace the title bar for the rest of the CMD session.
Work around the issue by spawning powershell using an API that doesn't give it a console handle in the first place, thus blocking it from being able to change the title bar.
1 parent c9f88b1 commit 2614675

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

clink/app/scripts/update.lua

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,11 +95,14 @@ local function find_prereqs()
9595
if not powershell_exe then
9696
prereq_error = log_info("unable to find PowerShell v5.")
9797
else
98-
local f = io.popen('2>&1 ' .. powershell_exe .. ' -Command "Get-Host | Select-Object Version"')
99-
if not f then
98+
-- clink.execute() launches powershell without a console window,
99+
-- which prevents PowerShell v4.0 on Windows 8.1 from altering the
100+
-- host's window title.
101+
local o = clink.execute('2>&1 ' .. powershell_exe .. ' -Command "Get-Host | Select-Object Version"')
102+
if type(o) ~= "table" then
100103
powershell_exe = nil
101104
else
102-
for line in f:lines() do
105+
for line in ipairs(o) do
103106
local ver = line:match("^ *([0-9]+%.[0-9]+)")
104107
if not prereq_error and ver then
105108
if is_rhs_version_newer("v" .. ver, "v5.0") then

0 commit comments

Comments
 (0)