Skip to content

Commit b163838

Browse files
Merge pull request #73 from uktrade/fix/move-sync-permission-error
fix: ensure the file has the right permission before moving
2 parents 59a9386 + a1535e6 commit b163838

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

src/plugin.js

+1
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@ const getCompareSnapshotsPlugin = on => {
133133
on('after:screenshot', details => {
134134
// Change screenshots file permission so it can be moved from drive to drive
135135
setFilePermission(details.path, 0o777)
136+
setFilePermission(paths.image.comparison(details.name), 0o777)
136137
renameAndMoveFile(details.path, paths.image.comparison(details.name))
137138
})
138139

src/utils.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ const readDir = dir => {
2323

2424
const setFilePermission = (dir, permission) => {
2525
try {
26-
const fd = fs.openSync(dir, 'r')
27-
fs.fchmodSync(fd, permission)
26+
if (fs.existsSync(dir)) {
27+
const fd = fs.openSync(dir, 'r')
28+
fs.fchmodSync(fd, permission)
29+
}
2830
} catch (error) {
2931
// eslint-disable-next-line no-console
3032
console.log(error)

0 commit comments

Comments
 (0)