chiark / gitweb /
debianutils: Update from 4.8.3 to 4.8.4
[termux-packages] / packages / nodejs / npm-link-patch.patch
1 --- ../node/deps/npm/node_modules/cacache/lib/util/move-file.js 2017-10-22 19:30:25.778456404 +0200
2 +++ ./deps/npm/node_modules/cacache/lib/util/move-file.js       2017-10-22 20:41:18.021337095 +0200
3 @@ -4,6 +4,7 @@
4  const BB = require('bluebird')
5  const chmod = BB.promisify(fs.chmod)
6  const unlink = BB.promisify(fs.unlink)
7 +const access = BB.promisify(fs.access)
8  let move
9  let pinflight
10  
11 @@ -18,6 +19,18 @@
12    // content their own way.
13    //
14    // Note that, as the name suggests, this strictly only supports file moves.
15 +
16 +
17 +  // Calling link() on android is not allowed, we get a SELinux security exception
18 +  if(process.platform === 'android') {
19 +    return access(dest, fs.constants.F_OK)
20 +      .catch(err => {
21 +        if (!move) { move = require('move-concurrently') }
22 +        return move(src, dest, { BB, fs })
23 +          .then(() => chmod(dest, '0444'))
24 +      })
25 +  }
26 +
27    return BB.fromNode(cb => {
28      fs.link(src, dest, err => {
29        if (err) {