Skip to content

Commit 4017826

Browse files
committed
TraceServer: Fix case of starting upon stored pid
Before this fix, a warning was always showed to the user upon an already "running" server, even in the case of a no longer running server. Meaning, in the case where a pid is still stored despite the corresponding process(es) not running anymore. Do an internal reset followed by a start attempt in such a case, to honor the genuine start command while duly resetting internally. Contributes to fixing #8. Signed-off-by: Marco Miller <marco.miller@ericsson.com>
1 parent 3828598 commit 4017826

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/trace-server.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,16 @@ export class TraceServer {
7474
const pid = context?.workspaceState.get(key);
7575
const stopped = !pid || pid === none;
7676
const foreigner = await this.isUp();
77+
7778
if (stopped && !foreigner) {
7879
this.start(context);
79-
} else {
80+
} else if (foreigner) {
8081
vscode.window.showWarningMessage(prefix + ' not started as already running.');
82+
} else {
83+
// Not UP but there is still a pid stored.
84+
// Likely because Codium or so exited without one using the stop command prior.
85+
context?.workspaceState.update(key, none);
86+
this.start(context);
8187
}
8288
}
8389

0 commit comments

Comments
 (0)