update scheduler

This commit is contained in:
leedongmyung 2025-01-19 17:02:25 +09:00
parent 5f2b056ac9
commit 72fd84be67
2 changed files with 28 additions and 28 deletions

View file

@ -4,8 +4,8 @@
$packageArgs = @{
packageName = $env:ChocolateyPackageName
unzipLocation = Join-Path $env:LOCALAPPDATA 'com.toki-labs.oto'
url = 'http://toki-labs.com/cdn/oto/windows/oto_x64_v0.0.281.zip'
url64bit = 'http://toki-labs.com/cdn/oto/windows/oto_x64_v0.0.281.zip'
url = 'http://toki-labs.com/cdn/oto/windows/oto_x64_v0.0.284.zip'
url64bit = 'http://toki-labs.com/cdn/oto/windows/oto_x64_v0.0.284.zip'
checksum = '' # Optional: Provide checksum if available
checksumType = 'sha256' # Adjust if checksum is provided
validExitCodes= @(0) # Only exit code 0 is considered valid
@ -42,13 +42,20 @@ if (Test-Path -Path $otoPath) {
# Step 3: Execute startup script if it exists
$startupScriptPath = Join-Path $env:LOCALAPPDATA "com.toki-labs.oto/startup/com.toki-labs.oto.ps1"
$otoExePath = Join-Path $env:LOCALAPPDATA "com.toki-labs.oto/oto.exe"
if (Test-Path $startupScriptPath) {
Write-Host "Found startup script at $startupScriptPath. Executing..."
try {
& $startupScriptPath
Write-Host "Successfully executed $startupScriptPath."
} catch {
Write-Host "Error executing $startupScriptPath : $_"
Write-Host "Found startup script at $startupScriptPath."
if (Test-Path $otoExePath) {
Write-Host "Found oto.exe at $otoExePath. Starting scheduler in background..."
try {
Start-Process -FilePath $otoExePath -ArgumentList "scheduler -s" -NoNewWindow -PassThru | Out-Null
Write-Host "Successfully started oto.exe scheduler in background."
} catch {
Write-Host "Error starting oto.exe scheduler: $_"
}
} else {
Write-Host "oto.exe not found at $otoExePath. Skipping scheduler start."
}
} else {
Write-Host "Startup script not found at $startupScriptPath. Skipping execution."

View file

@ -254,28 +254,21 @@ class SchedulerManager {
var processes = await findProcess(Platform.isWindows
? (isDebug ? 'dart.exe' : '$appName.exe')
: 'scheduler -s');
if (Platform.isWindows) {
for (var process in processes) {
_currentScheduler = process;
break;
for (var process in processes) {
var processName = process.name;
if (isDebug) {
if (processName.contains('main.dart scheduler -s')) {
_currentScheduler = process;
}
} else {
if (processName.contains('$appName.exe scheduler -s')) {
_currentScheduler = process;
}
}
} else {
for (var process in processes) {
var processName = process.name;
if (isDebug) {
if (processName.contains('main.dart scheduler -s')) {
_currentScheduler = process;
}
} else {
if (processName.contains('$appName.exe scheduler -s')) {
_currentScheduler = process;
}
}
if (_currentScheduler != null) {
print('Scheduler is running on pid [${_currentScheduler!.pid}].');
break;
}
if (_currentScheduler != null) {
print('Scheduler is running on pid [${_currentScheduler!.pid}].');
break;
}
}
return simpleFuture;