Skip to content

Commit

Permalink
fix: Windows support for automatic token provisioning (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
arnauorriols authored Feb 8, 2024
1 parent 28e8488 commit 3d0ba0f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/utils/access_token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ async function provision(): Promise<string> {

wait("").start().info(`Authorization URL: ${url}`);
let openCmd;
const args = [];
// TODO(arnauorriols): use npm:open or deno.land/x/open when either is compatible
switch (Deno.build.os) {
case "darwin": {
Expand All @@ -55,15 +56,18 @@ async function provision(): Promise<string> {
break;
}
case "windows": {
openCmd = "start";
// Windows Start-Process is a cmdlet of PowerShell
openCmd = "PowerShell.exe";
args.push("Start-Process");
break;
}
}
args.push(url);
let open;
if (openCmd !== undefined) {
try {
open = new Deno.Command(openCmd, {
args: [url],
args,
stderr: "piped",
stdout: "piped",
})
Expand Down

0 comments on commit 3d0ba0f

Please sign in to comment.