mirror of
https://github.com/whyour/qinglong.git
synced 2025-10-14 05:16:08 +08:00
修复 task 命令可能软链失败
This commit is contained in:
parent
e4f733320d
commit
a7baeba755
|
@ -13,7 +13,7 @@ async function linkToNodeModule(src: string, dst?: string) {
|
||||||
if (!stats) {
|
if (!stats) {
|
||||||
await fs.symlink(source, target, 'dir');
|
await fs.symlink(source, target, 'dir');
|
||||||
}
|
}
|
||||||
} catch (error) {}
|
} catch (error) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
async function linkCommand() {
|
async function linkCommand() {
|
||||||
|
@ -36,6 +36,10 @@ async function linkCommand() {
|
||||||
const source = path.join(config.rootPath, 'shell', link.src);
|
const source = path.join(config.rootPath, 'shell', link.src);
|
||||||
const target = path.join(commandDir, link.dest);
|
const target = path.join(commandDir, link.dest);
|
||||||
const tmpTarget = path.join(commandDir, link.tmp);
|
const tmpTarget = path.join(commandDir, link.tmp);
|
||||||
|
const stats = await fs.lstat(tmpTarget);
|
||||||
|
if (stats) {
|
||||||
|
await fs.unlink(tmpTarget);
|
||||||
|
}
|
||||||
await fs.symlink(source, tmpTarget);
|
await fs.symlink(source, tmpTarget);
|
||||||
await fs.rename(tmpTarget, target);
|
await fs.rename(tmpTarget, target);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user