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

watcher - do not restart when normal termination #174709

Merged
merged 1 commit into from Feb 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/vs/platform/files/common/watcher.ts
Expand Up @@ -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
Expand Down
Expand Up @@ -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}`);
}
}
});

Expand Down