update code refactoring

This commit is contained in:
leedongmyung 2025-01-01 19:29:32 +09:00
parent ff46b25868
commit 815d07af52
3 changed files with 28 additions and 11 deletions

View file

@ -1,3 +1,5 @@
// ignore_for_file: depend_on_referenced_packages
import 'dart:collection';
import 'dart:convert';
import 'dart:io';
@ -227,14 +229,23 @@ class SchedulerManager {
Future _startProcess() async {
//Launchd로
if (_currentScheduler == null) {
var script = isDebug ? ' $scriptPath' : '';
var shell = StringBuffer();
shell.writeln('nohup $executablePath$script scheduler -s &');
// shell.writeln('disown');
print(shell.toString());
ProcessExecutor.run(shell,
workspace: Directory.systemTemp.path, printStdout: false);
await _checkProcess();
if (Platform.isWindows) {
final program = Platform.resolvedExecutable;
var arguments = <String>[];
if (isDebug) arguments.add(scriptPath);
arguments.addAll(['scheduler', '-s']);
await Process.start(program, arguments,
mode: ProcessStartMode.detached);
} else {
var script = isDebug ? ' $scriptPath' : '';
var shell = StringBuffer();
shell.writeln('nohup $executablePath$script scheduler -s &');
// shell.writeln('disown');
print(shell.toString());
ProcessExecutor.run(shell,
workspace: Directory.systemTemp.path, printStdout: false);
await _checkProcess();
}
}
return simpleFuture;
}

View file

@ -1,6 +1,11 @@
import 'dart:io';
import 'package:oto_cli/cli/commands/scheduler/scheduler_manager.dart';
class SchedulerWindows extends SchedulerManager {
}
@override
String get exePath {
var exe = Platform.resolvedExecutable;
return exe;
}
}

View file

@ -126,8 +126,9 @@ class Application {
exit(10);
}
if (logEnable)
if (logEnable) {
await printBuildStep('Build Successfully Complete', Color.cyan);
}
if (buildType != BuildType.scheduler) {
exit(0);
}