mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
install: add timeout to update from yarnpkg
This commit is contained in:
1 parent
7d6b1f3bbc
commit
080f92ae74
1 file changed
+8
-7
+8
-7
@@ -242,23 +242,24 @@ connect-timeout = 10`);
|
|||||||
init: 'install.hydro',
|
init: 'install.hydro',
|
||||||
operations: [
|
operations: [
|
||||||
() => removeOptionalEsbuildDeps(),
|
() => removeOptionalEsbuildDeps(),
|
||||||
() => {
|
(CN ? () => {
|
||||||
if (!CN) return;
|
let res: any = null;
|
||||||
try {
|
try {
|
||||||
exec('yarn config set registry https://registry.npmmirror.com/', { stdio: 'inherit' });
|
exec('yarn config set registry https://registry.npmmirror.com/', { stdio: 'inherit' });
|
||||||
exec('yarn global add hydrooj @hydrooj/ui-default @hydrooj/hydrojudge', { stdio: 'inherit' });
|
res = exec('yarn global add hydrooj @hydrooj/ui-default @hydrooj/hydrojudge', { stdio: 'inherit' });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Failed to install from npmmirror, fallback to yarnpkg');
|
console.log('Failed to install from npmmirror, fallback to yarnpkg');
|
||||||
} finally {
|
} finally {
|
||||||
exec('yarn config set registry https://registry.yarnpkg.com', { stdio: 'inherit' });
|
exec('yarn config set registry https://registry.yarnpkg.com', { stdio: 'inherit' });
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
exec('yarn global add hydrooj @hydrooj/ui-default @hydrooj/hydrojudge');
|
exec('yarn global add hydrooj @hydrooj/ui-default @hydrooj/hydrojudge', { timeout: 60000 });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Failed to check update from yarnpkg');
|
console.warn('Failed to check update from yarnpkg');
|
||||||
|
if (res?.code !== 0) return 'retry';
|
||||||
}
|
}
|
||||||
},
|
return null;
|
||||||
['yarn global add hydrooj @hydrooj/ui-default @hydrooj/hydrojudge', { retry: true }],
|
} : ['yarn global add hydrooj @hydrooj/ui-default @hydrooj/hydrojudge', { retry: true }]),
|
||||||
() => writeFileSync(`${process.env.HOME}/.hydro/addon.json`, '["@hydrooj/ui-default","@hydrooj/hydrojudge"]'),
|
() => writeFileSync(`${process.env.HOME}/.hydro/addon.json`, '["@hydrooj/ui-default","@hydrooj/hydrojudge"]'),
|
||||||
() => rollbackResolveField(),
|
() => rollbackResolveField(),
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in new issue
Block a user