Compare commits

..

55 Commits

Author SHA1 Message Date
Vallie Joseph 4e88f1375d updating test 2023-03-14 13:27:35 +00:00
Vallie Joseph 992d977c74 Merge branch 'users/cory-miller/test-validate' into users/vmjoseph/rmrf-windows-os-fix 2023-03-14 13:24:22 +00:00
Vallie Joseph 035a7bbf6e Adding force exit 2023-03-14 04:20:38 +00:00
Vallie Joseph 9437454416 formatting 2023-03-14 04:15:42 +00:00
Vallie Joseph 6fae5a046b updating lock 2023-03-14 04:09:24 +00:00
Vallie Joseph 6bb14c42ee Adding version check 2023-03-14 03:52:20 +00:00
Vallie Joseph 9f3f840120 adding tests 2023-03-14 03:35:11 +00:00
Cory Miller 7cbe5b9470 . 2023-03-13 16:39:43 +00:00
Cory Miller 59ec9d07a4 . 2023-03-13 16:35:29 +00:00
Cory Miller 8e804e9f8d locks 2023-03-13 16:07:26 +00:00
Cory Miller 63de74f29d . 2023-02-23 17:29:55 +00:00
Cory Miller 665b756702 try rmSync 2023-02-23 17:26:31 +00:00
Cory Miller 91f0c9b7d0 remove imports as well 2023-02-23 16:03:16 +00:00
Cory Miller 58890d888d remove exec file 2023-02-23 16:03:01 +00:00
Cory Miller b0377621eb just use node's rmrf 2023-02-23 15:48:03 +00:00
Cory Miller 9ff7fcb0e5 . 2023-02-22 15:54:19 +00:00
Cory Miller eed631025c . 2023-02-22 15:48:52 +00:00
Cory Miller d589c08bf4 . 2023-02-22 15:33:29 +00:00
Cory Miller 683cee159e . 2023-02-21 20:00:47 +00:00
Cory Miller 1e057c1e35 . 2023-02-21 19:44:40 +00:00
Cory Miller 5261f00994 . 2023-02-21 19:36:20 +00:00
Cory Miller 1f17f8bd0b . 2023-02-21 19:29:08 +00:00
Cory Miller 19e20568d3 . 2023-02-21 19:14:17 +00:00
Cory Miller e1ed8690d9 . 2023-02-21 18:59:31 +00:00
Cory Miller 6de6f42334 . 2023-02-21 18:51:47 +00:00
Cory Miller 4d807985ec . 2023-02-21 18:44:45 +00:00
Cory Miller 5a97107fca retires 2023-02-21 18:34:11 +00:00
Cory Miller c07cd3b44d . 2023-02-21 18:26:19 +00:00
Cory Miller fe0fbdccde test debug 2023-02-21 17:19:17 +00:00
Cory Miller 4272cd6ca1 . 2023-02-21 17:00:46 +00:00
Cory Miller 9529f35ffd switch to fs.rm 2023-02-21 16:50:10 +00:00
Cory Miller 5dde1c4cf6 add some more debug 2023-02-21 16:34:04 +00:00
Cory Miller 7a5a1c3d42 try inlining inputPath 2023-02-21 16:02:26 +00:00
Cory Miller bcf8127e13 remove err.code 2023-02-21 15:43:50 +00:00
Cory Miller a9ce8db226 add error handler 2023-02-21 15:40:11 +00:00
Cory Miller ed5722cdf7 lint 2023-02-21 15:33:28 +00:00
Cory Miller f1e183e98c revert shell change 2023-02-21 15:32:45 +00:00
Cory Miller d155e954a1 add debug for code 2023-02-21 15:27:48 +00:00
Cory Miller 3406ce58d6 separate args 2023-02-21 15:12:35 +00:00
Cory Miller b0ce9247be try shell true 2023-02-17 21:26:06 +00:00
Cory Miller 5ff5e4f9f0 . 2023-02-17 21:19:50 +00:00
Cory Miller f6011790d6 print spawnargs 2023-02-17 21:15:21 +00:00
Cory Miller 4f66571667 command escaping 2023-02-17 20:58:42 +00:00
Cory Miller b0f4d114f3 why are files still there 2023-02-17 20:53:21 +00:00
Cory Miller a25a620745 ls 2023-02-17 20:46:34 +00:00
Cory Miller 6a3c62d3a8 try ignore eperm 2023-02-17 20:37:22 +00:00
Cory Miller 6a357de342 await on exists 2023-02-17 20:30:21 +00:00
Cory Miller 8d2f32e652 only unlink if still exists 2023-02-17 20:24:10 +00:00
Cory Miller 35cba88c68 windows... 2023-02-17 20:09:53 +00:00
Cory Miller 6a330f08c2 add debug logs 2023-02-17 20:04:49 +00:00
Cory Miller 068db23ad8 add debug logs 2023-02-17 19:58:32 +00:00
Cory Miller 143b802c0a try quiet mode 2023-02-17 19:48:08 +00:00
Cory Miller f13d18d494 lint fixes 2023-02-17 18:36:02 +00:00
Cory Miller 41350470e5 remove semicolon 2023-02-17 18:30:40 +00:00
Cory Miller a730b5ca5f try awaiting spawn on windows 2023-02-17 18:26:26 +00:00
11 changed files with 221 additions and 140 deletions
+24 -18
View File
@@ -5,6 +5,9 @@
"packages": {
"": {
"name": "root",
"dependencies": {
"package-lock-only": "^0.0.4"
},
"devDependencies": {
"@types/jest": "^27.0.2",
"@types/node": "^16.18.1",
@@ -5450,7 +5453,6 @@
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"dev": true,
"dependencies": {
"color-convert": "^1.9.0"
},
@@ -6152,7 +6154,6 @@
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
"dev": true,
"dependencies": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
@@ -6354,7 +6355,6 @@
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
"dev": true,
"dependencies": {
"color-name": "1.1.3"
}
@@ -6362,8 +6362,7 @@
"node_modules/color-name": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
"dev": true
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
},
"node_modules/color-support": {
"version": "1.1.3",
@@ -7406,7 +7405,6 @@
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
"dev": true,
"engines": {
"node": ">=0.8.0"
}
@@ -8909,7 +8907,6 @@
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"dev": true,
"engines": {
"node": ">=4"
}
@@ -14404,6 +14401,15 @@
"url": "https://github.com/sponsors/sindresorhus"
}
},
"node_modules/package-lock-only": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/package-lock-only/-/package-lock-only-0.0.4.tgz",
"integrity": "sha512-fV1YHeTMWH5LKmdVqfWskm2/SG0iF2IrxJn3ziaPVx9CnpecGJzt8xXtLV+CYINENZwPFMtbxO5qupz0asNz1A==",
"hasInstallScript": true,
"dependencies": {
"chalk": "^2.4.1"
}
},
"node_modules/pacote": {
"version": "13.6.2",
"resolved": "https://registry.npmjs.org/pacote/-/pacote-13.6.2.tgz",
@@ -15758,7 +15764,6 @@
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"dev": true,
"dependencies": {
"has-flag": "^3.0.0"
},
@@ -21187,7 +21192,6 @@
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"dev": true,
"requires": {
"color-convert": "^1.9.0"
}
@@ -21719,7 +21723,6 @@
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
"dev": true,
"requires": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
@@ -21871,7 +21874,6 @@
"version": "1.9.3",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
"integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
"dev": true,
"requires": {
"color-name": "1.1.3"
}
@@ -21879,8 +21881,7 @@
"color-name": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
"dev": true
"integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU="
},
"color-support": {
"version": "1.1.3",
@@ -22680,8 +22681,7 @@
"escape-string-regexp": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=",
"dev": true
"integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
},
"escodegen": {
"version": "2.0.0",
@@ -23831,8 +23831,7 @@
"has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"dev": true
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0="
},
"has-symbols": {
"version": "1.0.0",
@@ -27986,6 +27985,14 @@
"p-reduce": "^2.0.0"
}
},
"package-lock-only": {
"version": "0.0.4",
"resolved": "https://registry.npmjs.org/package-lock-only/-/package-lock-only-0.0.4.tgz",
"integrity": "sha512-fV1YHeTMWH5LKmdVqfWskm2/SG0iF2IrxJn3ziaPVx9CnpecGJzt8xXtLV+CYINENZwPFMtbxO5qupz0asNz1A==",
"requires": {
"chalk": "^2.4.1"
}
},
"pacote": {
"version": "13.6.2",
"resolved": "https://registry.npmjs.org/pacote/-/pacote-13.6.2.tgz",
@@ -29006,7 +29013,6 @@
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"dev": true,
"requires": {
"has-flag": "^3.0.0"
}
+4 -1
View File
@@ -11,7 +11,7 @@
"lint": "eslint packages/**/*.ts",
"lint-fix": "eslint packages/**/*.ts --fix",
"new-package": "scripts/create-package",
"test": "jest --testTimeout 10000"
"test": "jest --testTimeout 10000 --forceExit"
},
"devDependencies": {
"@types/jest": "^27.0.2",
@@ -28,5 +28,8 @@
"prettier": "^1.19.1",
"ts-jest": "^27.0.5",
"typescript": "^3.9.9"
},
"dependencies": {
"package-lock-only": "^0.0.4"
}
}
-30
View File
@@ -9,11 +9,7 @@
"version": "3.2.1",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.10.0",
"@actions/exec": "^1.0.1",
"@actions/glob": "^0.1.0",
"@actions/http-client": "^2.0.1",
"@actions/io": "^1.0.1",
"@azure/abort-controller": "^1.1.0",
"@azure/ms-rest-js": "^2.6.0",
"@azure/storage-blob": "^12.13.0",
@@ -43,14 +39,6 @@
"uuid": "dist/bin/uuid"
}
},
"node_modules/@actions/exec": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.1.tgz",
"integrity": "sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==",
"dependencies": {
"@actions/io": "^1.0.1"
}
},
"node_modules/@actions/glob": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.1.0.tgz",
@@ -68,11 +56,6 @@
"tunnel": "^0.0.6"
}
},
"node_modules/@actions/io": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.3.tgz",
"integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q=="
},
"node_modules/@azure/abort-controller": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-1.1.0.tgz",
@@ -628,14 +611,6 @@
}
}
},
"@actions/exec": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.1.1.tgz",
"integrity": "sha512-+sCcHHbVdk93a0XT19ECtO/gIXoxvdsgQLzb2fE2/5sIZmWQuluYyjPQtrtTHdU1YzTZ7bAPN4sITq2xi1679w==",
"requires": {
"@actions/io": "^1.0.1"
}
},
"@actions/glob": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/@actions/glob/-/glob-0.1.0.tgz",
@@ -653,11 +628,6 @@
"tunnel": "^0.0.6"
}
},
"@actions/io": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/@actions/io/-/io-1.1.3.tgz",
"integrity": "sha512-wi9JjgKLYS7U/z8PPbco+PvTb/nRWjeoFlJ1Qer83k/3C5PHQi28hiVdeE2kHXmIL99mQFawx8qt/JPjZilJ8Q=="
},
"@azure/abort-controller": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@azure/abort-controller/-/abort-controller-1.1.0.tgz",
+32 -8
View File
@@ -12,6 +12,8 @@ import {SocketTimeout} from './constants'
import {DownloadOptions} from '../options'
import {retryHttpClientResponse} from './requestUtils'
import {AbortController} from '@azure/abort-controller'
/**
* Pipes the body of a HTTP response to a stream
*
@@ -249,8 +251,8 @@ export async function downloadCacheStorageSDK(
try {
downloadProgress.startDisplayTimer()
// const controller = new AbortController()
// const abortSignal = controller.signal
const controller = new AbortController()
const abortSignal = controller.signal
while (!downloadProgress.isDone()) {
const segmentStart =
downloadProgress.segmentOffset + downloadProgress.segmentSize
@@ -261,15 +263,22 @@ export async function downloadCacheStorageSDK(
)
downloadProgress.nextSegment(segmentSize)
const result = await client.downloadToBuffer(
segmentStart,
segmentSize,
{
const result = await promiseWithTimeout(
options.segmentTimeoutInMs || 3600000,
client.downloadToBuffer(segmentStart, segmentSize, {
abortSignal,
concurrency: options.downloadConcurrency,
onProgress: downloadProgress.onProgress()
}
})
)
fs.writeFileSync(fd, result)
if (result === 'timeout') {
controller.abort()
throw new Error(
'Aborting cache download as the download time exceeded the timeout.'
)
} else if (Buffer.isBuffer(result)) {
fs.writeFileSync(fd, result)
}
}
} finally {
downloadProgress.stopDisplayTimer()
@@ -277,3 +286,18 @@ export async function downloadCacheStorageSDK(
}
}
}
const promiseWithTimeout = async (
timeoutMs: number,
promise: Promise<Buffer>
): Promise<unknown> => {
let timeoutHandle: NodeJS.Timeout
const timeoutPromise = new Promise(resolve => {
timeoutHandle = setTimeout(() => resolve('timeout'), timeoutMs)
})
return Promise.race([promise, timeoutPromise]).then(result => {
clearTimeout(timeoutHandle)
return result
})
}
+88 -42
View File
@@ -1,27 +1,12 @@
{
"name": "@actions/glob",
"version": "0.4.0",
"lockfileVersion": 3,
"lockfileVersion": 2,
"requires": true,
"description": "Actions glob lib",
"files": [
"lib",
"!.DS_Store"
],
"homepage": "https://github.com/actions/toolkit/tree/main/packages/glob",
"keywords": [
"github",
"actions",
"glob"
],
"license": "MIT",
"main": "lib/glob.js",
"preview": true,
"types": "lib/glob.d.ts",
"packages": {
"": {
"name": "@actions/glob",
"version": "0.4.0",
"version": "0.3.0",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.9.1",
@@ -29,17 +14,26 @@
}
},
"node_modules/@actions/core": {
"version": "1.10.0",
"integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==",
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.9.1.tgz",
"integrity": "sha512-5ad+U2YGrmmiw6du20AQW5XuWo7UKN2052FjSV7MX+Wfjf8sCqcsZe62NfgHys4QI4/Y+vQvLKYL8jWtA1ZBTA==",
"dependencies": {
"@actions/http-client": "^2.0.1",
"uuid": "^8.3.2"
}
},
"node_modules/@actions/http-client": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
"integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
"dependencies": {
"tunnel": "^0.0.6"
}
},
"node_modules/balanced-match": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
},
"node_modules/brace-expansion": {
"version": "1.1.11",
@@ -53,7 +47,7 @@
"node_modules/concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg=="
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"node_modules/minimatch": {
"version": "3.1.2",
@@ -65,26 +59,78 @@
"engines": {
"node": "*"
}
},
"node_modules/tunnel": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==",
"engines": {
"node": ">=0.6.11 <=0.7.0 || >=0.7.3"
}
},
"node_modules/uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
"bin": {
"uuid": "dist/bin/uuid"
}
}
},
"bugs": {
"url": "https://github.com/actions/toolkit/issues"
},
"directories": {
"lib": "lib",
"test": "__tests__"
},
"publishConfig": {
"access": "public"
},
"repository": {
"directory": "packages/glob",
"type": "git",
"url": "git+https://github.com/actions/toolkit.git"
},
"scripts": {
"audit-moderate": "npm install && npm audit --json --audit-level=moderate > audit.json",
"test": "echo \"Error: run tests from root\" && exit 1",
"tsc": "tsc"
"dependencies": {
"@actions/core": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.9.1.tgz",
"integrity": "sha512-5ad+U2YGrmmiw6du20AQW5XuWo7UKN2052FjSV7MX+Wfjf8sCqcsZe62NfgHys4QI4/Y+vQvLKYL8jWtA1ZBTA==",
"requires": {
"@actions/http-client": "^2.0.1",
"uuid": "^8.3.2"
}
},
"@actions/http-client": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
"integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
"requires": {
"tunnel": "^0.0.6"
}
},
"balanced-match": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
"integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c="
},
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
"integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
"requires": {
"balanced-match": "^1.0.0",
"concat-map": "0.0.1"
}
},
"concat-map": {
"version": "0.0.1",
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"minimatch": {
"version": "3.1.2",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz",
"integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==",
"requires": {
"brace-expansion": "^1.1.7"
}
},
"tunnel": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/tunnel/-/tunnel-0.0.6.tgz",
"integrity": "sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg=="
},
"uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
}
}
}
-3
View File
@@ -1,8 +1,5 @@
# @actions/io Releases
### 1.1.3
- Replace `child_process.exec` with `fs.rm` in `rmRF` for all OS implementations [#1373](https://github.com/actions/toolkit/pull/1373)
### 1.1.2
- Update `lockfileVersion` to `v2` in `package-lock.json [#1020](https://github.com/actions/toolkit/pull/1020)
+61 -18
View File
@@ -6,7 +6,11 @@ import * as io from '../src/io'
import * as ioUtil from '../src/io-util'
describe('cp', () => {
beforeAll(async () => {
beforeEach(async () => {
await io.mkdirP(getTestTemp())
})
afterEach(async () => {
await io.rmRF(getTestTemp())
})
@@ -193,7 +197,11 @@ describe('cp', () => {
})
describe('mv', () => {
beforeAll(async () => {
beforeEach(async () => {
await io.mkdirP(getTestTemp())
})
afterEach(async () => {
await io.rmRF(getTestTemp())
})
@@ -295,7 +303,11 @@ describe('mv', () => {
})
describe('rmRF', () => {
beforeAll(async () => {
beforeEach(async () => {
await io.mkdirP(getTestTemp())
})
afterEach(async () => {
await io.rmRF(getTestTemp())
})
@@ -327,27 +339,26 @@ describe('rmRF', () => {
await io.mkdirP(testPath)
await assertExists(testPath)
// can't remove folder with locked file on windows
const filePath = path.join(testPath, 'file.txt')
await fs.appendFile(filePath, 'some data')
await assertExists(filePath)
// For windows we need to explicitly set an exclusive lock flag, because by default Node will open the file with the 'Delete' FileShare flag.
// See the exclusive lock windows flag definition:
// https://github.com/nodejs/node/blob/c2e4b1fa9ad0b744616c4e4c13a5017772a630c4/deps/uv/src/win/fs.c#L499-L513
const fd = await fs.open(
filePath,
fs.constants.O_RDONLY | ioUtil.UV_FS_O_EXLOCK
)
const fd = await fs.open(filePath, fs.constants.O_RDONLY | 0x10000000)
await io.rmRF(testPath)
// // can't remove folder with locked file on windows
if (ioUtil.IS_WINDOWS) {
// On Windows, we expect an error due to an lstat call implementation in the underlying libuv code.
// See https://github.com/libuv/libuv/issues/3267 is resolved
await expect(async () => io.rmRF(testPath)).rejects.toThrow('EBUSY')
try {
// additionally, can't stat an open file on Windows without getting EPERM
await io.rmRF(testPath)
} catch (err) {
expect(err.code).toBe('EPERM')
}
} else {
await io.rmRF(testPath)
await assertNotExists(testPath)
}
await fd.close()
await io.rmRF(testPath)
await assertNotExists(testPath)
@@ -385,6 +396,26 @@ describe('rmRF', () => {
await assertNotExists(file)
})
it('removes symlink folder with rmRF', async () => {
// create the following layout:
// real_directory
// real_directory/real_file
// symlink_directory -> real_directory
const root: string = path.join(getTestTemp(), 'rmRF_sym_dir_test')
const realDirectory: string = path.join(root, 'real_directory')
const realFile: string = path.join(root, 'real_directory', 'real_file')
const symlinkDirectory: string = path.join(root, 'symlink_directory')
await io.mkdirP(realDirectory)
await fs.writeFile(realFile, 'test file content')
await createSymlinkDir(realDirectory, symlinkDirectory)
await assertExists(path.join(symlinkDirectory, 'real_file'))
await io.rmRF(symlinkDirectory)
await assertExists(realDirectory)
await assertExists(realFile)
await assertNotExists(symlinkDirectory)
})
// creating a symlink to a file on Windows requires elevated
if (os.platform() !== 'win32') {
it('removes symlink file with rmRF', async () => {
@@ -729,7 +760,11 @@ describe('rmRF', () => {
})
describe('mkdirP', () => {
beforeAll(async () => {
beforeEach(async () => {
await io.mkdirP(getTestTemp())
})
afterEach(async () => {
await io.rmRF(getTestTemp())
})
@@ -867,7 +902,11 @@ describe('mkdirP', () => {
})
describe('which', () => {
beforeAll(async () => {
beforeEach(async () => {
await io.mkdirP(getTestTemp())
})
afterEach(async () => {
await io.rmRF(getTestTemp())
})
@@ -1404,7 +1443,11 @@ describe('which', () => {
})
describe('findInPath', () => {
beforeAll(async () => {
beforeEach(async () => {
await io.mkdirP(getTestTemp())
})
afterEach(async () => {
await io.rmRF(getTestTemp())
})
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "@actions/io",
"version": "1.1.3",
"version": "1.1.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "@actions/io",
"version": "1.1.3",
"version": "1.1.2",
"license": "MIT"
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@actions/io",
"version": "1.1.3",
"version": "1.1.2",
"description": "Actions io lib",
"keywords": [
"github",
+3 -6
View File
@@ -1,26 +1,23 @@
import * as fs from 'fs'
import * as path from 'path'
export const {
access,
chmod,
copyFile,
lstat,
mkdir,
open,
readdir,
readlink,
rename,
rm,
rmdir,
rm,
stat,
symlink,
unlink
} = fs.promises
// export const {open} = 'fs'
export const IS_WINDOWS = process.platform === 'win32'
// See https://github.com/nodejs/node/blob/d0153aee367422d0858105abec186da4dff0a0c5/deps/uv/include/uv/win.h#L691
export const UV_FS_O_EXLOCK = 0x10000000
export const READONLY = fs.constants.O_RDONLY
export async function exists(fsPath: string): Promise<boolean> {
try {
+6 -11
View File
@@ -119,17 +119,12 @@ export async function rmRF(inputPath: string): Promise<void> {
)
}
}
try {
// note if path does not exist, error is silent
await ioUtil.rm(inputPath, {
force: true,
maxRetries: 3,
recursive: true,
retryDelay: 300
})
} catch (err) {
throw new Error(`File was unable to be removed ${err}`)
}
ioUtil.rm(inputPath, {
force: true,
maxRetries: 3,
recursive: true,
retryDelay: 300
})
}
/**