mirror of
https://github.com/MillironX/setup-nextflow.git
synced 2024-11-25 18:59:55 +00:00
Merge pull request #14 from data-intuitive/add-try-catch
Add try catch to fs.renameSync
This commit is contained in:
commit
b9495c9762
2 changed files with 11 additions and 1 deletions
|
@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
## Changed
|
||||||
|
|
||||||
|
- If `fs.renameSync` fails (e.g. because source and destination files are on different partitions), try `fs.copySync` and `fs.unlinkSync` instead (#14).
|
||||||
|
|
||||||
## [1.3.0] - 2023-05-19
|
## [1.3.0] - 2023-05-19
|
||||||
|
|
||||||
## Changed
|
## Changed
|
||||||
|
|
|
@ -106,7 +106,13 @@ export async function install_nextflow(
|
||||||
const temp_install_dir = fs.mkdtempSync(`nxf-${version}`)
|
const temp_install_dir = fs.mkdtempSync(`nxf-${version}`)
|
||||||
const nf_path = `${temp_install_dir}/nextflow`
|
const nf_path = `${temp_install_dir}/nextflow`
|
||||||
|
|
||||||
fs.renameSync(nf_dl_path, nf_path)
|
try {
|
||||||
|
fs.renameSync(nf_dl_path, nf_path)
|
||||||
|
} catch (err: unknown) {
|
||||||
|
core.debug(`Failed to rename file: ${err}`)
|
||||||
|
fs.copyFileSync(nf_dl_path, nf_path)
|
||||||
|
fs.unlinkSync(nf_dl_path)
|
||||||
|
}
|
||||||
fs.chmodSync(nf_path, "0711")
|
fs.chmodSync(nf_path, "0711")
|
||||||
|
|
||||||
return temp_install_dir
|
return temp_install_dir
|
||||||
|
|
Loading…
Reference in a new issue