Skip to content

Commit 7d35dad

Browse files
committed
Never quit when parent is 1 at fist
1 parent 037c2ee commit 7d35dad

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

asprocess/asprocess.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,12 @@ func (v *aspContext) InstallSignals() {
9898
func (v *aspContext) WatchParent() {
9999
ppid := os.Getppid()
100100

101+
// If parent is 1 when start, ignore.
102+
if ppid == 1 {
103+
ol.T(v.ctx, "ignore parent event for ppid is 1")
104+
return
105+
}
106+
101107
go func() {
102108
for {
103109
if pid := os.Getppid(); pid == 1 || pid != ppid {
@@ -126,6 +132,12 @@ type aspContextNoExit struct {
126132
func (v *aspContextNoExit) WatchParent() {
127133
ppid := os.Getppid()
128134

135+
// If parent is 1 when start, ignore.
136+
if ppid == 1 {
137+
ol.T(v.ctx, "ignore parent event for ppid is 1")
138+
return
139+
}
140+
129141
go func() {
130142
for {
131143
if pid := os.Getppid(); pid == 1 || pid != ppid {

0 commit comments

Comments
 (0)