VS2015 Cordova MDAVSCLI : error : EBUSY, resource

2019-09-11 06:41发布

问题:

I have a solution structure in which I´m using some projects with symbolic links to allow an easy reuse of code among different solutions.

It was working flawlessly on VS2013 CTP3.1, but on VS2015 I keep getting ,intermittently, the following:

MDAVSCLI : error : EBUSY, resource busy or locked 'F:\Github\softwrench\softwrench.sw4.pae\offline_content\pae'
1>      at Error (native)
1>      at Object.fs.symlinkSync (fs.js:848:18)
1>      at cpdirSyncRecursive (C:\Users\rolim\AppData\Roaming\npm\node_modules\vs-tac\node_modules\cordova\5.1.1\node_modules\cordova\node_modules\cordova-lib\node_modules\shelljs\src\cp.js:76:10)
1>      at cpdirSyncRecursive (C:\Users\rolim\AppData\Roaming\npm\node_modules\vs-tac\node_modules\cordova\5.1.1\node_modules\cordova\node_modules\cordova-lib\node_modules\shelljs\src\cp.js:73:7)
1>      at C:\Users\rolim\AppData\Roaming\npm\node_modules\vs-tac\node_modules\cordova\5.1.1\node_modules\cordova\node_modules\cordova-lib\node_modules\shelljs\src\cp.js:180:9
1>      at Array.forEach (native)
1>      at Object._cp (C:\Users\rolim\AppData\Roaming\npm\node_modules\vs-tac\node_modules\cordova\5.1.1\node_modules\cordova\node_modules\cordova-lib\node_modules\shelljs\src\cp.js:157:11)
1>      at Object.cp (C:\Users\rolim\AppData\Roaming\npm\node_modules\vs-tac\node_modules\cordova\5.1.1\node_modules\cordova\node_modules\cordova-lib\node_modules\shelljs\src\common.js:186:23)
1>      at android_parser.update_www (C:\Users\rolim\AppData\Roaming\npm\node_modules\vs-tac\node_modules\cordova\5.1.1\node_modules\cordova\node_modules\cordova-lib\src\cordova\metadata\android_parser.js:316:11)
1>      at C:\Users\rolim\AppData\Roaming\npm\node_modules\vs-tac\node_modules\cordova\5.1.1\node_modules\cordova\node_modules\cordova-lib\src\cordova\prepare.js:96:20

I looked at the code and it seems to try to handle symlinks, so It seems like a bug:

 if (srcFileStat.isDirectory()) {
  /* recursion this thing right on back. */
  cpdirSyncRecursive(srcFile, destFile, opts);
} else if (srcFileStat.isSymbolicLink()) {
  var symlinkFull = fs.readlinkSync(srcFile);
 76: fs.symlinkSync(symlinkFull, destFile, os.platform() === "win32" ? "junction" : null);
} else {
  /* At this point, we've hit a file actually worth copying... so copy it on over. */
  if (fs.existsSync(destFile) && !opts.force) {
    common.log('skipping existing file: ' + files[i]);
  } else {
    copyFileSync(srcFile, destFile);
  }
}

Anyone would know what´s going on here?

tks

回答1:

In the end the only solution I could come up with was to edit the cp.js file of the cordova-lib project, for line 71, so that symlinks got the same handling as ordinary directories:

So:

if (srcFileStat.isDirectory()) {

Became:

if (srcFileStat.isDirectory() || srcFileStat.isSymbolicLink()) {

Not sure if any implications, not that I´ve noticed so far.

Hope it helps anyone else