Skip to content
This repository was archived by the owner on Jan 23, 2021. It is now read-only.

Commit 1d65767

Browse files
committed
Issue #276: Get getuid() when setting the default tempDir.
1 parent 942bf64 commit 1d65767

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

index.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,16 @@ var replaceLocation = utils.replaceLocation;
2020
var createIntermediatePath = utils.createIntermediatePath;
2121

2222
var defaults = {
23-
tempDir: osTmpdir(),
23+
tempDir: path.join(osTmpdir(), 'gulp-ruby-sass'),
2424
verbose: false,
2525
sourcemap: false,
2626
emitCompileError: false
2727
};
2828

29+
if (typeof process.getuid === 'function') {
30+
defaults.tempDir += '-' + process.getuid();
31+
}
32+
2933
function gulpRubySass(sources, options) {
3034
var stream = new Readable({objectMode: true});
3135

@@ -215,7 +219,7 @@ gulpRubySass.logError = function (err) {
215219

216220
gulpRubySass.clearCache = function (tempDir) {
217221
tempDir = tempDir || defaults.tempDir;
218-
rimraf.sync(path.join(tempDir, defaults.tempSubDir));
222+
rimraf.sync(tempDir);
219223
};
220224

221225
module.exports = gulpRubySass;

lib/utils.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,8 @@ exports.emitErr = function (stream, err) {
1313
// and all matched files. Switching options does not break Sass cache so we do
1414
// it ourselves. Possibly a bug: https://github.com/sass/sass/issues/1830
1515
exports.createIntermediatePath = function (sources, matches, options) {
16-
defaults.tempSubDir = 'gulp-ruby-sass';
17-
if (typeof process.getuid === 'function') {
18-
defaults.tempSubDir += '-' + process.getuid();
19-
}
2016
return path.join(
2117
options.tempDir,
22-
defaults.tempSubDir,
2318
md5Hex(
2419
process.cwd() +
2520
JSON.stringify(sources) +

0 commit comments

Comments
 (0)