@@ -12,13 +12,11 @@ import (
12
12
"os"
13
13
"os/exec"
14
14
"path/filepath"
15
- "syscall"
16
15
"text/template"
17
16
"time"
18
17
19
18
"github.com/docker/go-units"
20
19
"github.com/lima-vm/go-qcow2reader"
21
- "github.com/mattn/go-isatty"
22
20
"github.com/sirupsen/logrus"
23
21
24
22
"github.com/lima-vm/lima/pkg/downloader"
@@ -29,7 +27,6 @@ import (
29
27
hostagentevents "github.com/lima-vm/lima/pkg/hostagent/events"
30
28
"github.com/lima-vm/lima/pkg/imgutil/proxyimgutil"
31
29
"github.com/lima-vm/lima/pkg/limayaml"
32
- "github.com/lima-vm/lima/pkg/osutil"
33
30
"github.com/lima-vm/lima/pkg/store"
34
31
"github.com/lima-vm/lima/pkg/store/filenames"
35
32
"github.com/lima-vm/lima/pkg/usrlocalsharelima"
@@ -249,25 +246,7 @@ func Start(ctx context.Context, inst *store.Instance, limactl string, launchHost
249
246
begin := time .Now () // used for logrus propagation
250
247
251
248
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 {
271
250
return err
272
251
}
273
252
} else if err := haCmd .Start (); err != nil {
0 commit comments