Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct File.clone() treatment of File.stats #8

Merged
merged 3 commits into from
Jan 11, 2014

Conversation

hughsk
Copy link
Contributor

@hughsk hughsk commented Jan 11, 2014

Cloning the stats object would remove its prototype, meaning it would lose methods normally available on fs.Stats
instances, such as Stats.isDirectory() or Stats.isFile()

This was giving me errors when cloning vinyl instances and then piping them to gulp.dest() streams, which do a directory check if the stats property is present:

/Users/hughsk/Desktop/repos/gulp/lib/createOutputStream/index.js:19
      if (file.stat && file.stat.isDirectory()) {
                                 ^
TypeError: Object #<Object> has no method 'isDirectory'
    at /Users/hughsk/Desktop/repos/gulp/lib/createOutputStream/index.js:19:34
    at /Users/hughsk/Desktop/repos/gulp/node_modules/mkdirp/index.js:38:26
    at Object.oncomplete (fs.js:107:15)

This should fix the problem :)

Cloning the stats object would remove its prototype,
meaning it would lose methods normally available on fs.Stats
instances, such as Stats.isDirectory() or Stats.isFile()

This resulted in errors being thrown whenever a cloned file
was piped through to a gulp.dest() stream when it expected
the isDirectory() method.
@hughsk
Copy link
Contributor Author

hughsk commented Jan 11, 2014

@contra using the freshly published clone-stats module now, look good to merge?

@yocontra
Copy link
Member

@hughsk the module needs tests and so does this PR

@hughsk
Copy link
Contributor Author

hughsk commented Jan 11, 2014

@contra done, for both.

yocontra added a commit that referenced this pull request Jan 11, 2014
Correct File.clone() treatment of File.stats
@yocontra yocontra merged commit 431753f into gulpjs:master Jan 11, 2014
phated pushed a commit that referenced this pull request Sep 27, 2016
Correct File.clone() treatment of File.stats
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants