mirror of https://git.tuxpa.in/a/code-server.git
Refactor vscode init to use async
Hopefully is a bit easier to read.
This commit is contained in:
parent
71850e312b
commit
4574593664
|
@ -22,18 +22,14 @@ router.get("/", async (req, res) => {
|
||||||
|
|
||||||
const [content, options] = await Promise.all([
|
const [content, options] = await Promise.all([
|
||||||
await fs.readFile(path.join(rootPath, "src/browser/pages/vscode.html"), "utf8"),
|
await fs.readFile(path.join(rootPath, "src/browser/pages/vscode.html"), "utf8"),
|
||||||
vscode
|
(async () => {
|
||||||
.initialize(
|
try {
|
||||||
{
|
return await vscode.initialize({ args: req.args, remoteAuthority: req.headers.host || "" }, req.query)
|
||||||
args: req.args,
|
} catch (error) {
|
||||||
remoteAuthority: req.headers.host || "",
|
|
||||||
},
|
|
||||||
req.query,
|
|
||||||
)
|
|
||||||
.catch((error) => {
|
|
||||||
const devMessage = commit === "development" ? "It might not have finished compiling." : ""
|
const devMessage = commit === "development" ? "It might not have finished compiling." : ""
|
||||||
throw new Error(`VS Code failed to load. ${devMessage} ${error.message}`)
|
throw new Error(`VS Code failed to load. ${devMessage} ${error.message}`)
|
||||||
}),
|
}
|
||||||
|
})(),
|
||||||
])
|
])
|
||||||
|
|
||||||
options.productConfiguration.codeServerVersion = version
|
options.productConfiguration.codeServerVersion = version
|
||||||
|
|
Loading…
Reference in New Issue