Skip to content

Commit fd98894

Browse files
committed
fix: Deno 2 support
1 parent dc048fb commit fd98894

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

src/fs.ts

+3-5
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@ import { groupBy, maxBy, sortBy } from "./deps.ts";
22

33
type FsEvent = {
44
ts: number;
5-
kind: "any" | "access" | "create" | "modify" | "remove" | "other";
5+
kind: Deno.FsEvent["kind"];
66
path: string;
7-
flag?: Deno.FsEventFlag;
87
};
98

109
type FsEventObservableOpts = {
@@ -45,14 +44,13 @@ class FsEventObservable {
4544
}, 100);
4645

4746
for await (const event of watcher) {
48-
const { kind, paths, flag } = event;
47+
const { kind, paths } = event;
4948

5049
for (const path of paths) {
51-
const event = {
50+
const event: FsEvent = {
5251
ts: performance.now(),
5352
kind,
5453
path,
55-
flag,
5654
};
5755

5856
this.buffer.push(event);

src/runner.ts

+12-11
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,23 @@ interface RunResult {
88
}
99

1010
const check = async (exercise: Exercise): Promise<RunResult> => {
11-
const p = Deno.run({
12-
cmd: ["deno", "check", exercise.path],
11+
const p = new Deno.Command("deno", {
12+
args: ["check", exercise.path],
1313
stdout: "piped",
1414
stderr: "piped",
1515
});
16-
const { success } = await p.status();
17-
let output: string;
18-
if (success) {
19-
output = d.decode(await p.output());
20-
p.stderr.close();
16+
17+
const { code, stdout, stderr } = await p.output();
18+
19+
const ok = code === 0;
20+
21+
let output: Uint8Array;
22+
if (ok) {
23+
output = stdout;
2124
} else {
22-
output = d.decode(await p.stderrOutput());
23-
p.stdout.close();
25+
output = stderr;
2426
}
25-
p.close();
26-
return { ok: success, output };
27+
return { ok, output: new TextDecoder().decode(output) };
2728
};
2829

2930
const isDone = async (exercise: Exercise): Promise<boolean> => {

0 commit comments

Comments
 (0)