mirror of
https://github.com/labring/sealos.git
synced 2026-09-24 15:46:19 +08:00
fix:template frontend leaves zombie git processes (#4799)
* fix:template process issue * update label width
This commit is contained in:
@@ -74,17 +74,20 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse<
|
||||
const branch = process.env.TEMPLATE_REPO_BRANCH || 'main';
|
||||
|
||||
try {
|
||||
execAsync('git config --global --add safe.directory /app/providers/template/templates');
|
||||
const timeoutPromise = new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
reject(new Error('operation timed out'));
|
||||
}, 60 * 1000);
|
||||
});
|
||||
const gitOperationPromise = !fs.existsSync(targetPath)
|
||||
? execAsync(`git clone -b ${branch} ${repoHttpUrl} ${targetPath} --depth=1`)
|
||||
: execAsync(`cd ${targetPath} && git pull --depth=1 --rebase`);
|
||||
const gitConfigResult = await execAsync(
|
||||
'git config --global --add safe.directory /app/providers/template/templates',
|
||||
{ timeout: 10000 }
|
||||
);
|
||||
|
||||
await Promise.race([gitOperationPromise, timeoutPromise]);
|
||||
console.log('git config:', gitConfigResult);
|
||||
|
||||
const gitCommand = !fs.existsSync(targetPath)
|
||||
? `git clone -b ${branch} ${repoHttpUrl} ${targetPath} --depth=1`
|
||||
: `cd ${targetPath} && git pull --depth=1 --rebase`;
|
||||
|
||||
const result = await execAsync(gitCommand, { timeout: 60000 });
|
||||
|
||||
console.log('git operation:', result);
|
||||
} catch (error) {
|
||||
console.log('git operation timed out: \n', error);
|
||||
}
|
||||
|
||||
@@ -103,6 +103,8 @@ const Form = ({
|
||||
className="template-dynamic-label"
|
||||
color={'#333'}
|
||||
userSelect={'none'}
|
||||
whiteSpace={'pre-wrap'}
|
||||
wordBreak={'break-word'}
|
||||
>
|
||||
{item?.label}
|
||||
{item?.required && (
|
||||
|
||||
Reference in New Issue
Block a user