mirror of
https://github.com/lordmathis/llamactl.git
synced 2025-11-05 16:44:22 +00:00
Merge pull request #47 from lordmathis/fix/nil-context
fix: Initialize context before building command
This commit is contained in:
@@ -37,6 +37,9 @@ func (i *Process) Start() error {
|
|||||||
// Initialize last request time to current time when starting
|
// Initialize last request time to current time when starting
|
||||||
i.lastRequestTime.Store(i.timeProvider.Now().Unix())
|
i.lastRequestTime.Store(i.timeProvider.Now().Unix())
|
||||||
|
|
||||||
|
// Create context before building command (needed for CommandContext)
|
||||||
|
i.ctx, i.cancel = context.WithCancel(context.Background())
|
||||||
|
|
||||||
// Create log files
|
// Create log files
|
||||||
if err := i.logger.Create(); err != nil {
|
if err := i.logger.Create(); err != nil {
|
||||||
return fmt.Errorf("failed to create log files: %w", err)
|
return fmt.Errorf("failed to create log files: %w", err)
|
||||||
@@ -47,8 +50,6 @@ func (i *Process) Start() error {
|
|||||||
if cmdErr != nil {
|
if cmdErr != nil {
|
||||||
return fmt.Errorf("failed to build command: %w", cmdErr)
|
return fmt.Errorf("failed to build command: %w", cmdErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
i.ctx, i.cancel = context.WithCancel(context.Background())
|
|
||||||
i.cmd = cmd
|
i.cmd = cmd
|
||||||
|
|
||||||
if runtime.GOOS != "windows" {
|
if runtime.GOOS != "windows" {
|
||||||
|
|||||||
Reference in New Issue
Block a user