atom-gpp-compiler icon indicating copy to clipboard operation
atom-gpp-compiler copied to clipboard

No Compiling Error text file

Open jeetmehta13 opened this issue 5 years ago • 5 comments

No compiling error text file appears when compilation fails. Js Stack Trace Error shows up.

jeetmehta13 avatar Oct 20 '19 09:10 jeetmehta13

Same problem here, 'compiling_error.txt' does not appear for 2 weeks ago. the option for 'compiling_error.txt' is enabled in gpp-compiler settings

mysticizer avatar Oct 28 '19 15:10 mysticizer

No compiling error text file appears when compilation fails. Js Stack Trace Error shows up.

I got it work properly by modifying following codes within ~/.atom/packages/gpp-compiler/index.js

(line 298~300) fs.writeFile(path.join(info.dir, "compiling_error.txt"), stderr);
-> fs.writeFileSync(path.join(info.dir, "compiling_error.txt"), stderr);
(line 431) fs.unlinkSync(path.join(info.dir, "compiling_error.txt"));
-> fs.unlinkSync(path.join(info.dir, "compiling_error.txt"));

mysticizer avatar Nov 10 '19 03:11 mysticizer

it helped but still it doesnt update after first time the compile_error.txt .we have to close and reopen.

manraj1729 avatar Apr 16 '20 13:04 manraj1729

it helped but still it doesnt update after first time the compile_error.txt .we have to close and reopen.

It works for me, giving all errors in the same file. With compile_error.txt loaded in atom, it seems to update automatically.

For what its worth the compile_error.txt file is created in the same directory as file being compiled.

RichardMorris avatar Dec 01 '20 20:12 RichardMorris

Actually a better fix might be to use the asynchronous write, but add an error callback to the function call.

fs.writeFile(path.join(info.dir, "compiling_error.txt"), stderr,  (stderr) => {
	if (stderr) {
		atom.
		notifications.
		addWarning(stderr.replace(/\n/g, "<br/>"));
	}
});

and

fs.unlink(path.join(info.dir, "compiling_error.txt"), (err) => {
	if (err) {
		atom.
		notifications.
		addWarning(stderr.replace(/\n/g, "<br/>")); 
	}
});

As seen in this diff of the pull request https://github.com/kriscross07/atom-gpp-compiler/pull/285/commits/cbff40e2bf3d2c2e65a705fa5d00c7f6137dd42d.

Either will work but an asynchronous file write is probably more robust.

RichardMorris avatar Dec 01 '20 21:12 RichardMorris