| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…ist previously
…ecause of Node 0.8
|
Why the tmp stream? Instead of: try { fs.unlinkSync(outfile); } catch(err) { } |
Sorry, something went wrong.
|
Generic answer : I personally hate software which does what it wasn't asked to do :-) |
Sorry, something went wrong.
|
Ah makes sense. The fs.createWriteStream(outfile) will write to the file (thus emptying it if it existed before) pretty much always before any error ever gets emitted by browserify. But at least you're leaving the file behind. Ok cool, but that tmp stream 🙀 var outfileExists;
if (outfile) {
try { outfileExists = !!fs.lstatSync(outfile); } catch (err) {}
bundle.pipe(fs.createWriteStream(outfile));
} |
Sorry, something went wrong.
|
makes sense, thanks. Updated. |
Sorry, something went wrong.
|
I'm against adding .sync calls. This patch also seems to add a lot more complexity that will probably break in strange ways. Writing to a tmp file was removed from watchify for this reason since it kept breaking on windows. I'm skeptical that this kind of patch won't ripple up to create problems. |
Sorry, something went wrong.
|
@substack, are you against this PR entirely, or just against replacing the test for existence by opening the stream with lstatSync()? Without this PR (or equivalent) browserify breaks make-based workflows and forces use of make kludges like DELETE_ON_ERROR which do not exist in all flavors of make |
Sorry, something went wrong.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
The change is trivial. I didn't use fs.exists() because it's being deprecated soon according to the recent Node documentation.