this repo has no description smallweb.run
smallweb
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

improve error handling in ssh command execution

pomdtr ea8d0619 ea7e3d86

+9 -2
+9 -2
cmd/up.go
··· 281 281 if sess.User() == "_" { 282 282 execPath, err := os.Executable() 283 283 if err != nil { 284 - 284 + fmt.Fprintf(sess.Stderr(), "failed to get executable path: %v\n", err) 285 + sess.Exit(1) 286 + return 285 287 } 286 288 287 289 cmd = exec.Command(execPath, sess.Command()...) ··· 292 294 a, err := app.LoadApp(sess.User(), k.String("dir"), k.String("domain"), slices.Contains(k.Strings("adminApps"), sess.User())) 293 295 if err != nil { 294 296 fmt.Fprintf(sess, "failed to load app: %v\n", err) 297 + sess.Exit(1) 295 298 return 296 299 } 297 300 ··· 299 302 command, err := wk.Command(sess.Context(), sess.Command()...) 300 303 if err != nil { 301 304 fmt.Fprintf(sess, "failed to get command: %v\n", err) 305 + sess.Exit(1) 302 306 return 303 307 } 304 308 ··· 310 314 cmd.Env = append(cmd.Env, fmt.Sprintf("TERM=%s", ptyReq.Term)) 311 315 f, err := pty.Start(cmd) 312 316 if err != nil { 313 - panic(err) 317 + fmt.Fprintf(sess, "failed to start pty: %v\n", err) 318 + sess.Exit(1) 319 + return 314 320 } 315 321 go func() { 316 322 for win := range winCh { ··· 338 344 stdin, err := cmd.StdinPipe() 339 345 if err != nil { 340 346 fmt.Fprintf(sess, "failed to get stdin: %v\n", err) 347 + sess.Exit(1) 341 348 return 342 349 } 343 350