@@ -85,6 +85,7 @@ func ExecBinaryWithEnv(binary string, envs []string) bool {
85
85
}
86
86
87
87
func Background (homeDir string ) error {
88
+ terminal .Logger .Debug ().Str ("source" , "reexec" ).Msg ("let's go to the background!" )
88
89
if util .IsGoRun () {
89
90
return errors .New ("Not applicable in a Go run context" )
90
91
}
@@ -116,7 +117,6 @@ func Background(homeDir string) error {
116
117
os .Setenv ("REEXEC_WATCH_PID" , shellPID )
117
118
}
118
119
119
- terminal .Logger .Debug ().Msg ("Let's go to the background!" )
120
120
p , err := Respawn ()
121
121
if err != nil {
122
122
return errors .Wrap (err , "Could not respawn" )
@@ -157,14 +157,13 @@ func Background(homeDir string) error {
157
157
// end-up receiving a status in statusCh so no particular
158
158
// processing to do here.
159
159
case event := <- watcherChan :
160
- terminal .Logger .Info ( ).Msg ("FS event received: " + event .Event ().String ())
160
+ terminal .Logger .Debug (). Str ( "source" , "reexec" ).Msg ("FS event received: " + event .Event ().String ())
161
161
if event .Event () == notify .Remove {
162
162
return nil
163
163
}
164
164
165
165
if event .Event () == notify .Write {
166
166
ticker .Stop ()
167
- break
168
167
}
169
168
case status := <- statusCh :
170
169
return console .Exit ("" , status )
@@ -176,6 +175,7 @@ func Background(homeDir string) error {
176
175
}
177
176
178
177
func NotifyForeground (status string ) error {
178
+ terminal .Logger .Debug ().Str ("source" , "reexec" ).Msg ("notify foreground" )
179
179
if ! IsChild () {
180
180
return nil
181
181
}
@@ -195,6 +195,7 @@ func NotifyForeground(status string) error {
195
195
}
196
196
197
197
func WatchParent (stopCh chan bool ) error {
198
+ terminal .Logger .Debug ().Str ("source" , "reexec" ).Msg ("watch parent" )
198
199
spid := os .Getenv ("REEXEC_WATCH_PID" )
199
200
if spid == "" {
200
201
return nil
@@ -223,6 +224,7 @@ func WatchParent(stopCh chan bool) error {
223
224
}
224
225
225
226
func Restart (postRespawn func ()) error {
227
+ terminal .Logger .Debug ().Str ("source" , "reexec" ).Msg ("restart" )
226
228
if err := os .Setenv ("REEXEC_PPID" , fmt .Sprint (os .Getpid ())); nil != err {
227
229
return errors .WithStack (err )
228
230
}
@@ -280,6 +282,7 @@ func Restart(postRespawn func()) error {
280
282
}
281
283
282
284
func Respawn () (* os.Process , error ) {
285
+ terminal .Logger .Debug ().Str ("source" , "reexec" ).Msg ("respawn" )
283
286
argv0 , err := console .CurrentBinaryPath ()
284
287
if err != nil {
285
288
return nil , err
0 commit comments