fix: ci test

This commit is contained in:
Cheng Liu 2024-10-21 21:34:32 -07:00
parent e379119283
commit 97adbfc17b
No known key found for this signature in database
GPG key ID: BDD2FDCF5AC296BA

View file

@ -109,11 +109,12 @@ export class ListProfilesCommand implements ICommand<IListProfilesCommandOptions
.join(' ')} `;
let res: { projects: IProject[] } | undefined;
const resultString: string = childProcess.execSync(rushListCmd).toString();
const firstOpenBraceIndex: number = resultString.indexOf('{');
try {
res = JSON.parse(resultString);
res = JSON.parse(resultString.slice(firstOpenBraceIndex));
} catch (e) {
throw new Error(
`Parse json result from ${rushListCmd} failed.\nError: ${e.message}\nrush returns:\n${resultString}\n`
`Parse json result from "${rushListCmd}" failed.\nError: ${e.message}\nrush returns:\n${resultString}\n`
);
}
if (res) {