devcontainers / devcontainers/features
No xdg-open command, so host Browser cannot be started
- Dominant language
- Shell
- Stars
- 1.5k
- Forks
- 621
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 4
Description
When starting a browser by executing cli on a terminal in devcontainer (VSCode Remote - Container), if the browser startup depends on xdg-open, it will fail because the xdg-open command does not exist.
For example, the following is obtained by executing cdktf init.
```
$ cdktf init --template="typescript"
Welcome to CDK for Terraform!
By default, cdktf allows you to manage the state of your stacks using Terraform Cloud for free.
cdktf will request an API token for app.terraform.io using your browser.
If login is successful, cdktf will store the token in plain text in
the following file for use by subsequent Terraform commands:
/home/node/.terraform.d/credentials.tfrc.json
Note: The local storage mode isn't recommended for storing the state of your stacks.
? Do you want to continue with Terraform Cloud remote state management? Yes
opening webpage using your browser.....
If the web browser didn't open the window automatically, you can go to the following url:
https://app.terraform.io/app/settings/tokens?source=terraform-login
? Token for app.terraform.io 🔑 [input is hidden] /usr/local/share/npm-global/lib/node_modules/cdktf-cli/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
throw ex;
^
Error: spawn xdg-open ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn xdg-open',
path: 'xdg-open',
spawnargs: [
'https://app.terraform.io/app/settings/tokens?source=terraform-login'
]
}
```
CLI tools that use the environment variable BROWSER, such as github-cli, are not affected, but there must be many CLI tools that use xdg-open.
I originally submitted the form below, but I thought it was a devcontainer issue, so I submitted it here.
https://github.com/hashicorp/terraform-cdk/issues/2132
Contributor guide
Assessment
This issue has not been assessed yet.