Skip to content

Commit

Permalink
fix(daemon): add access to reload events to support vscode on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
Qu4k committed May 23, 2020
1 parent 3dcdc9a commit a3a0a3c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/daemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class Daemon implements AsyncIterable<DenonEvent> {
*/
private async reload() {
if (this.#config.logger.fullscreen) {
log.debug("Clearing screen");
log.debug("clearing screen");
console.clear();
}

Expand All @@ -42,11 +42,11 @@ export class Daemon implements AsyncIterable<DenonEvent> {
for (let id in pcopy) {
const p = pcopy[id];
if (Deno.build.os === "windows") {
log.debug(`Closing process with pid ${p.pid}`);
log.debug(`closing (windows) process with pid ${p.pid}`);
p.close();
} else {
log.debug(`Killing process with pid ${p.pid}`);
p.kill(Deno.Signal.SIGUSR2);
log.debug(`killing (unix) process with pid ${p.pid}`);
Deno.kill(p.pid, Deno.Signal.SIGKILL);
}
}

Expand All @@ -55,6 +55,7 @@ export class Daemon implements AsyncIterable<DenonEvent> {

private async start() {
const process = this.#denon.runner.execute(this.#script);
log.debug(`starting process with pid ${process.pid}`);
this.#processes[process.pid] = (process);
this.monitor(process);
}
Expand Down Expand Up @@ -92,7 +93,8 @@ export class Daemon implements AsyncIterable<DenonEvent> {
};
this.start();
for await (const watchE of this.#denon.watcher) {
if (watchE.some((_) => _.type === "modify")) {
if (watchE.some((_) => _.type === "modify" || _.type === "access")) {
log.debug(`reload event detected, starting the reload procedure...`);
yield {
type: "reload",
change: watchE,
Expand Down
1 change: 0 additions & 1 deletion src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ export class Runner {
execute(script: string): Deno.Process {
const command = this.build(script);
log.info(`starting \`${command.cmd.join(" ")}\``);
log.debug(`using options`);
const options = {
cmd: command.cmd,
env: command.options.env ?? {},
Expand Down

0 comments on commit a3a0a3c

Please sign in to comment.