From 72fd84be67a434294d110b1001def9f236ac4c9a Mon Sep 17 00:00:00 2001 From: leedongmyung Date: Sun, 19 Jan 2025 17:02:25 +0900 Subject: [PATCH] update scheduler --- .../chocolatey/tools/chocolateyinstall.ps1 | 23 ++++++++----- .../commands/scheduler/scheduler_manager.dart | 33 ++++++++----------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/assets/package/chocolatey/tools/chocolateyinstall.ps1 b/assets/package/chocolatey/tools/chocolateyinstall.ps1 index c5b5714..6fb018b 100644 --- a/assets/package/chocolatey/tools/chocolateyinstall.ps1 +++ b/assets/package/chocolatey/tools/chocolateyinstall.ps1 @@ -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." diff --git a/lib/cli/commands/scheduler/scheduler_manager.dart b/lib/cli/commands/scheduler/scheduler_manager.dart index ce554a0..a4a7e6e 100644 --- a/lib/cli/commands/scheduler/scheduler_manager.dart +++ b/lib/cli/commands/scheduler/scheduler_manager.dart @@ -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;