mirror of
https://github.com/mudler/LocalAI.git
synced 2026-10-29 17:48:59 -04:00
fix(cli): report a failed write of the MLX hostfile
The tunnel callback ignored the error of os.WriteFile and set the hostfile variable even when the file was not written. It now logs the error and leaves the variable alone. Assisted-by: Claude Code:claude-sonnet-5-5 go Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
This commit is contained in:
1 file changed
+4
-1
+4
-1
@@ -382,7 +382,10 @@ func (r *RunCMD) Run(ctx *cliContext.Context) (result error) {
|
||||
config.WithMLXTunnelCallback(func(tunnels []string) {
|
||||
hostfile := filepath.Join(os.TempDir(), "localai_mlx_hostfile.json")
|
||||
data, _ := json.Marshal(tunnels)
|
||||
os.WriteFile(hostfile, data, 0600)
|
||||
if err := os.WriteFile(hostfile, data, 0600); err != nil {
|
||||
xlog.Error("failed to write MLX hostfile", "path", hostfile, "error", err)
|
||||
return
|
||||
}
|
||||
os.Setenv("MLX_DISTRIBUTED_HOSTFILE", hostfile)
|
||||
xlog.Debug("setting MLX_DISTRIBUTED_HOSTFILE", "value", hostfile, "tunnels", tunnels)
|
||||
}),
|
||||
|
||||
Reference in new issue
Block a user