| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b24ee07 commit 4dce39a
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -23,6 +23,7 @@ | |||
| 23 | 23 | const common = require('../common'); | |
| 24 | 24 | const assert = require('assert'); | |
| 25 | 25 | const fs = require('fs'); | |
| 26 | + const { COPYFILE_FICLONE } = fs.constants; | ||
| 26 | 27 | const path = require('path'); | |
| 27 | 28 | const tmpdir = require('../common/tmpdir'); | |
| 28 | 29 | const msg = { test: 'this' }; | |
@@ -44,7 +45,7 @@ if (process.env.FORK) { | |||
| 44 | 45 | } catch (e) { | |
| 45 | 46 | if (e.code !== 'ENOENT') throw e; | |
| 46 | 47 | } | |
| 47 | - fs.writeFileSync(copyPath, fs.readFileSync(nodePath)); | ||
| 48 | + fs.copyFileSync(nodePath, copyPath, COPYFILE_FICLONE); | ||
| 48 | 49 | fs.chmodSync(copyPath, '0755'); | |
| 49 | 50 | ||
| 50 | 51 | // slow but simple | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -4,6 +4,7 @@ const fixtures = require('../common/fixtures'); | |||
| 4 | 4 | const assert = require('assert'); | |
| 5 | 5 | const path = require('path'); | |
| 6 | 6 | const fs = require('fs'); | |
| 7 | + const { COPYFILE_FICLONE } = fs.constants; | ||
| 7 | 8 | const child_process = require('child_process'); | |
| 8 | 9 | const pkgName = 'foo'; | |
| 9 | 10 | const { addLibraryPath } = require('../common/shared-lib-util'); | |
@@ -28,7 +29,7 @@ if (process.argv[2] === 'child') { | |||
| 28 | 29 | testExecPath = path.join(prefixBinPath, path.basename(process.execPath)); | |
| 29 | 30 | } | |
| 30 | 31 | const mode = fs.statSync(process.execPath).mode; | |
| 31 | - fs.writeFileSync(testExecPath, fs.readFileSync(process.execPath)); | ||
| 32 | + fs.copyFileSync(process.execPath, testExecPath, COPYFILE_FICLONE); | ||
| 32 | 33 | fs.chmodSync(testExecPath, mode); | |
| 33 | 34 | ||
| 34 | 35 | const runTest = (expectedString, env) => { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments