More useless tweaks to fix Windows

This commit is contained in:
Empathic Qubit 2021-04-29 05:33:47 -04:00
parent 5857d14824
commit ea6b102678
2 changed files with 10 additions and 3 deletions

View file

@ -5,7 +5,9 @@ local util = dofile(base.."/util.lua")
local serpent = dofile(base.."/serpent.lua")
local libDeflate = dofile(base.."/LibDeflate.lua")
local hasThreads = not util.isWin and config.NeatConfig.Threads > 1
local hasThreads =
not util.isWin and
config.NeatConfig.Threads > 1
local Runner = nil
if hasThreads then
Runner = dofile(base.."/runner-wrapper.lua")

View file

@ -99,8 +99,13 @@ function _M.waitForChange(filenames, count, wild)
local sec, usec = utime()
print(string.format('Starting watching file at %d', sec * 1000000 + usec))
return _M.popenCmd([[powershell "$filename = ']]..wild..
[[' ; $targetCount = ]]..count..[[ ; $count = 0 ; Register-ObjectEvent (New-Object IO.FileSystemWatcher (Split-Path $filename), (Split-Path -Leaf $filename) -Property @{ IncludeSubdirectories = $false ; NotifyFilter = [IO.NotifyFilters]'FileName, LastWrite'}) -EventName Changed -SourceIdentifier RunnerDataChanged -Action { $count += 1 ; if ( $count -ge $targetCount ) { [Environment]::Exit(0) } } ; while($true) { Start-Sleep -Milliseconds 1 }"]])
local poppet = _M.popenCmd([[powershell "$filename = ']]..wild..
[[' ; $targetCount = ]]..count..[[ ; $count = 0 ; $action = { $count += 1 ; if ( $count -ge $targetCount ) { [Environment]::Exit(0) } } ; (Register-ObjectEvent (New-Object IO.FileSystemWatcher (Split-Path $filename), (Split-Path -Leaf $filename) -Property @{ IncludeSubdirectories = $false ; NotifyFilter = [IO.NotifyFilters]'FileName, LastWrite'}) -EventName Changed -SourceIdentifier RunnerDataChanged -Action $action).Name ; while($true) { Start-Sleep -Seconds 5 }"]])
while poppet:read('*l'):sub(1, 17) ~= 'RunnerDataChanged' do
end
return poppet
else
local watchCmd = ''
if count == 1 then