@@ -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/v2/pkg/downloader"
@@ -29,7 +27,6 @@ import (
2927 hostagentevents "github.com/lima-vm/lima/v2/pkg/hostagent/events"
3028 "github.com/lima-vm/lima/v2/pkg/imgutil/proxyimgutil"
3129 "github.com/lima-vm/lima/v2/pkg/limayaml"
32- "github.com/lima-vm/lima/v2/pkg/osutil"
3330 "github.com/lima-vm/lima/v2/pkg/registry"
3431 "github.com/lima-vm/lima/v2/pkg/store"
3532 "github.com/lima-vm/lima/v2/pkg/store/filenames"
@@ -253,25 +250,7 @@ func Start(ctx context.Context, inst *store.Instance, limactl string, launchHost
253250 begin := time .Now () // used for logrus propagation
254251
255252 if launchHostAgentForeground {
256- logrus .Info ("Running the host agent in the foreground" )
257- if isatty .IsTerminal (os .Stdin .Fd ()) || isatty .IsCygwinTerminal (os .Stdin .Fd ()) {
258- // Write message to standard log files to avoid confusing users
259- message := "This log file is not used because `limactl start` was launched in the terminal with the `--foreground` option."
260- if _ , err := haStdoutW .WriteString (message ); err != nil {
261- return err
262- }
263- if _ , err := haStderrW .WriteString (message ); err != nil {
264- return err
265- }
266- } else {
267- if err := osutil .Dup2 (int (haStdoutW .Fd ()), syscall .Stdout ); err != nil {
268- return err
269- }
270- if err := osutil .Dup2 (int (haStderrW .Fd ()), syscall .Stderr ); err != nil {
271- return err
272- }
273- }
274- if err := syscall .Exec (limactl , haCmd .Args , haCmd .Environ ()); err != nil {
253+ if err := execHostAgentForeground (limactl , haCmd ); err != nil {
275254 return err
276255 }
277256 } else if err := haCmd .Start (); err != nil {
0 commit comments