Skip to content

Commit

Permalink
fix: when coder env variable is set - print open url
Browse files Browse the repository at this point in the history
  • Loading branch information
arybitskiy committed Nov 13, 2024
1 parent cae3437 commit 2212df4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions apps/cli/src/utils/open.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import openOriginal from "open";

export async function open(url: string, printer: Printer) {
try {
// Show url inside coder
if (process.env.CODER_WORKSPACE_AGENT_NAME) {
throw new Error("Cannot open browser in a headless environment");
}
return await openOriginal(url);
} catch (error: any) {
printer.printOperationMessage({
Expand Down

0 comments on commit 2212df4

Please sign in to comment.