Handle error from running lint command
toanpi opened this issue · comments
Hi @jbenden ,
For some reason, linter command got errors but it' seem that they are not handed --> So linter dose not work without any notifying user.
Is there any way to improve it ?
Thank!
`
public lint(fileName: string, directory: null | string, tmpFileName: string): InternalDiagnostic[] {
if (!this.enabled) { return []; }
let result = this.runLinter(this.buildCommandLine(fileName, tmpFileName), directory || this.workspaceRoot);
let stdout = result.stdout !== null ? result.stdout.replace(/\r/g, '').split('\n') : [];
let stderr = result.stderr !== null ? result.stderr.replace(/\r/g, '').split('\n') : [];
if (result.error) {
// Error here
console.error(result.error);
}
if (this.settings['c-cpp-flylint'].debug) {
console.log(stdout);
console.log(stderr);
}
if (result.status !== 0) {
console.log(`${this.name} exited with status code ${result.status}`);
}
return this.parseLines(stdout.concat(stderr));
}
`
Hi!
I'm not exactly sure of what you are saying. Would you mind rephrasing, and maybe adding in any extra details?
Thanks,
-Joe
In my case, I got error on Clang command: ENAMETOLANG
--> result from system call is error (stdout and stderr is null if I'm not mistaken)
let result = this.runLinter(this.buildCommandLine(fileName, tmpFileName), directory || this.workspaceRoot);
--> No warning or error showed without any messenger
--> That mean that linter's not running at all times!
You must be on Windows then. This occurs with paths that are too deeply nested. It's a known issue with NPM and Node.js.
Having said that, I do agree that this error message should bubble up into an UI error dialog.
Best regards,
-Joe
Agree totally!