@@ -12,13 +12,11 @@ import (
1212 "os"
1313 "os/exec"
1414 "path/filepath"
15- "syscall"
1615 "text/template"
1716 "time"
1817
1918 "github.com/docker/go-units"
2019 "github.com/lima-vm/go-qcow2reader"
21- "github.com/mattn/go-isatty"
2220 "github.com/sirupsen/logrus"
2321
2422 "github.com/lima-vm/lima/pkg/downloader"
@@ -29,7 +27,6 @@ import (
2927 hostagentevents "github.com/lima-vm/lima/pkg/hostagent/events"
3028 "github.com/lima-vm/lima/pkg/imgutil/proxyimgutil"
3129 "github.com/lima-vm/lima/pkg/limayaml"
32- "github.com/lima-vm/lima/pkg/osutil"
3330 "github.com/lima-vm/lima/pkg/store"
3431 "github.com/lima-vm/lima/pkg/store/filenames"
3532 "github.com/lima-vm/lima/pkg/usrlocalsharelima"
@@ -249,25 +246,7 @@ func Start(ctx context.Context, inst *store.Instance, limactl string, launchHost
249246 begin := time .Now () // used for logrus propagation
250247
251248 if launchHostAgentForeground {
252- logrus .Info ("Running the host agent in the foreground" )
253- if isatty .IsTerminal (os .Stdin .Fd ()) || isatty .IsCygwinTerminal (os .Stdin .Fd ()) {
254- // Write message to standard log files to avoid confusing users
255- message := "This log file is not used because `limactl start` was launched in the terminal with the `--foreground` option."
256- if _ , err := haStdoutW .WriteString (message ); err != nil {
257- return err
258- }
259- if _ , err := haStderrW .WriteString (message ); err != nil {
260- return err
261- }
262- } else {
263- if err := osutil .Dup2 (int (haStdoutW .Fd ()), syscall .Stdout ); err != nil {
264- return err
265- }
266- if err := osutil .Dup2 (int (haStderrW .Fd ()), syscall .Stderr ); err != nil {
267- return err
268- }
269- }
270- if err := syscall .Exec (limactl , haCmd .Args , haCmd .Environ ()); err != nil {
249+ if err := execHostAgentForeground (limactl , haCmd ); err != nil {
271250 return err
272251 }
273252 } else if err := haCmd .Start (); err != nil {
0 commit comments