Skip to content

Commit

Permalink
⬆️[x.x.o](_): Fix demo run
Browse files Browse the repository at this point in the history
  • Loading branch information
akira-toriyama committed May 26, 2023
1 parent 8c20fd7 commit 32c742d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
16 changes: 7 additions & 9 deletions src/external_interface/deno.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
type Run = (pa: {
cmd: Array<string>;
cmd: string;
args: Array<string>;
}) => Promise<string | void>;
export const run: Run = async (pa) => {
const p = Deno.run({
cmd: pa.cmd,
export const run: Run = (pa) => {
const cmd = new Deno.Command(pa.cmd, {
stdout: "piped",
stderr: "piped",
args: pa.args,
});

await p.status().catch(console.error);
p.close();

return p.output()
.then((v) => new TextDecoder().decode(v)).catch(console.error);
return cmd.output()
.then((v) => new TextDecoder().decode(v.stdout)).catch(console.error);
};

type WriteTextFile = (p: { path: string; data: string }) => Promise<void>;
Expand Down
8 changes: 7 additions & 1 deletion src/external_interface/gitHub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ type FetchIssues = () =>

export const fetchIssues: FetchIssues = () =>
deno.run({
cmd: ["gh", "issue", "list", "--assignee=@me", "--json=number,title"],
cmd: "gh",
args: [
"issue",
"list",
"--assignee=@me",
"--json=number,title",
],
})
.then<IssuesStruct>((v) => {
if (typeof v !== "string") {
Expand Down

0 comments on commit 32c742d

Please sign in to comment.