111
let markerIndex = content.lastIndexOf(marker);
112
while (markerIndex !== -1) {
114
>
const afterMarker = content.substring(markerIndex + marker.length);
115
>
const endIdx = afterMarker.indexOf('>>>');
116
>
if (endIdx !== -1) {
117
>
const exitCodeStr = afterMarker.substring(0, endIdx).trim();
118
>
if (/^-?\d+$/.test(exitCodeStr)) {
119
>
return {
120
>
found: true,
121
>
exitCode: parseInt(exitCodeStr, 10),
122
>
outputBeforeSentinel,
123
>
};
124
>
}
125
>
}
126
// Ignore echoed sentinel command text (for example `$?`) and continue
127
// scanning for the latest complete numeric sentinel marker.