Skip to content

Commit

Permalink
don't try to chown /bin/sh in test on Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Jul 3, 2019
1 parent b06e7ef commit f318a5e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
3 changes: 2 additions & 1 deletion test/symlink-sync.js
Expand Up @@ -27,7 +27,8 @@ exec("id", function (code, output) {
rimraf("dir", function (er) {
if (er) throw er
fs.mkdirSync("dir")
fs.symlinkSync("/bin/sh", "dir/sh-link")
fs.writeFileSync("dir/sh")
fs.symlinkSync("./sh", "dir/sh-link")
runTest()
})
})
Expand Down
11 changes: 7 additions & 4 deletions test/symlink.js
Expand Up @@ -2,6 +2,9 @@ if (!process.getuid || !process.getgid) {
throw new Error("Tests require getuid/getgid support")
}

var skip = process.platform === 'darwin' ? false
: 'linux and windows do not treat links as separate fs objects'

var curUid = +process.getuid()
, curGid = +process.getgid()
, chownr = require("../")
Expand All @@ -28,7 +31,8 @@ exec("id", function (code, output) {
rimraf("dir", function (er) {
if (er) throw er
fs.mkdirSync("dir")
fs.symlinkSync("/bin/sh", "dir/sh-link")
fs.writeFileSync("dir/sh")
fs.symlinkSync("./sh", "dir/sh-link")
runTest()
})
})
Expand All @@ -48,8 +52,8 @@ function runTest () {
t.ifError(er)
return t.end()
}
t.notEqual(st.uid, curUid, "uid not should be " + curUid)
t.notEqual(st.gid, groups[0], "gid not should be "+groups[0])
t.notEqual(st.uid, curUid, "uid", {skip})
t.notEqual(st.gid, groups[0], "gid", {skip})
t.end()
})
})
Expand All @@ -62,4 +66,3 @@ function runTest () {
})
})
}

0 comments on commit f318a5e

Please sign in to comment.