File tree Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Expand file tree Collapse file tree 2 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -113,5 +113,21 @@ public function throwIfFailedOnTerm(): void
113
113
throw new ProcessFailedException ($ this ->serviceProcess );
114
114
}
115
115
116
+ // ? interface
117
+ public function waitForTermination (int $ timeout ): void
118
+ {
119
+ $ elapsed = 0 ;
120
+ $ sleepInterval = 100 ; // Sleep for 100 milliseconds
121
+
122
+ while ($ this ->serviceProcess ->isRunning () && $ elapsed < $ timeout ) {
123
+ usleep ($ sleepInterval * 1000 );
124
+ $ elapsed += $ sleepInterval ;
125
+ }
126
+
127
+ if ($ this ->serviceProcess ->isRunning ()) {
128
+ throw new XsslessException ('Process did not terminate within the given timeout ' );
129
+ }
130
+ }
131
+
116
132
// ========================================================================
117
133
}
Original file line number Diff line number Diff line change 70
70
));
71
71
72
72
expect (fn () => $ service ->start ())->toThrow (ProcessFailedException::class);
73
- expect ($ service ->serviceProcess ->getTermSignal ())->toBe (127 );
74
- // TODO: fix https://github.com/medilies/xssless/actions/runs/10283025153/job/28455979969
75
- // TODO: wait for signal
73
+ $ service ->waitForTermination (2000 );
74
+ expect ($ service ->serviceProcess ->getExitCode ())->toBe (127 );
76
75
});
You can’t perform that action at this time.
0 commit comments