mirror of
https://github.com/microsoft/vscode.git
synced 2026-07-13 21:47:12 -05:00
watcher - do not restart when normal termination (#174709)
This commit is contained in:
@@ -218,6 +218,10 @@ export abstract class AbstractWatcherClient extends Disposable {
|
||||
this.onLogMessage({ type: 'error', message: `[File Watcher (${this.options.type})] ${message}` });
|
||||
}
|
||||
|
||||
protected trace(message: string) {
|
||||
this.onLogMessage({ type: 'trace', message: `[File Watcher (${this.options.type})] ${message}` });
|
||||
}
|
||||
|
||||
override dispose(): void {
|
||||
|
||||
// Render the watcher invalid from here
|
||||
|
||||
@@ -38,11 +38,16 @@ export class UniversalWatcherClient extends AbstractUniversalWatcherClient {
|
||||
});
|
||||
|
||||
// React on unexpected termination of the watcher process
|
||||
// We never expect the watcher to terminate by its own,
|
||||
// so if that happens we want to restart the watcher.
|
||||
// by listening to the `onDidTerminate` event. We do not
|
||||
// consider an exit code of `0` as abnormal termination.
|
||||
|
||||
onDidTerminate.then(({ reason }) => {
|
||||
if (reason) {
|
||||
this.onError(`terminated by itself with code ${reason.code}, signal: ${reason.signal}`);
|
||||
if (reason?.code === 0) {
|
||||
this.trace(`terminated by itself with code ${reason.code}, signal: ${reason.signal}`);
|
||||
} else {
|
||||
if (reason) {
|
||||
this.onError(`terminated by itself unexpectedly with code ${reason.code}, signal: ${reason.signal}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user