FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
flexpilot-ide/scripts/code-server.js at main · flexpilot-ai/flexpilot-ide · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
flexpilot-ai
/
flexpilot-ide
Public
forked from
microsoft/vscode
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
39
Star
2.7k
Code
Issues
9
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
flexpilot-ide
/
scripts
/
code-server.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
71 lines (58 loc) · 1.93 KB
Breadcrumbs
flexpilot-ide
/
scripts
/
code-server.js
Copy path
File metadata and controls
71 lines (58 loc) · 1.93 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
//
@ts
-check
const
cp
=
require
(
'child_process'
)
;
const
path
=
require
(
'path'
)
;
const
open
=
require
(
'open'
)
;
const
minimist
=
require
(
'minimist'
)
;
async
function
main
(
)
{
const
args
=
minimist
(
process
.
argv
.
slice
(
2
)
,
{
boolean
:
[
'help'
,
'launch'
]
}
)
;
if
(
args
.
help
)
{
console
.
log
(
'./scripts/code-server.sh|bat [options]\n'
+
' --launch Opens a browser'
)
;
startServer
(
[
'--help'
]
)
;
return
;
}
process
.
env
[
'VSCODE_SERVER_PORT'
]
=
'9888'
;
const
serverArgs
=
process
.
argv
.
slice
(
2
)
.
filter
(
v
=>
v
!==
'--launch'
)
;
const
addr
=
await
startServer
(
serverArgs
)
;
if
(
args
[
'launch'
]
)
{
open
(
addr
)
;
}
}
function
startServer
(
programArgs
)
{
return
new
Promise
(
(
s
,
e
)
=>
{
const
env
=
{
...
process
.
env
}
;
const
entryPoint
=
path
.
join
(
__dirname
,
'..'
,
'out'
,
'server-main.js'
)
;
console
.
log
(
`Starting server:
${
entryPoint
}
${
programArgs
.
join
(
' '
)
}
`
)
;
const
proc
=
cp
.
spawn
(
process
.
execPath
,
[
entryPoint
,
...
programArgs
]
,
{
env
,
stdio
:
[
process
.
stdin
,
null
,
process
.
stderr
]
}
)
;
proc
.
stdout
.
on
(
'data'
,
e
=>
{
const
data
=
e
.
toString
(
)
;
process
.
stdout
.
write
(
data
)
;
const
m
=
data
.
match
(
/
W
e
b
U
I
a
v
a
i
l
a
b
l
e
a
t
(
.
*
)
/
)
;
if
(
m
)
{
s
(
m
[
1
]
)
;
}
}
)
;
proc
.
on
(
'exit'
,
(
code
)
=>
process
.
exit
(
code
)
)
;
process
.
on
(
'exit'
,
(
)
=>
proc
.
kill
(
)
)
;
process
.
on
(
'SIGINT'
,
(
)
=>
{
proc
.
kill
(
)
;
process
.
exit
(
128
+
2
)
;
// https://nodejs.org/docs/v14.16.0/api/process.html#process_signal_events
}
)
;
process
.
on
(
'SIGTERM'
,
(
)
=>
{
proc
.
kill
(
)
;
process
.
exit
(
128
+
15
)
;
// https://nodejs.org/docs/v14.16.0/api/process.html#process_signal_events
}
)
;
}
)
;
}
main
(
)
;
Back
|
FazBrowse Home
|
New Git URL