FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
OneScript/src/VSCode.DebugAdapter/ServerProcess.cs at develop · dmpas/OneScript · GitHub
dmpas
/
OneScript
Public
forked from
EvilBeaver/OneScript
Notifications
You must be signed in to change notification settings
Fork
0
Star
3
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
OneScript
/
src
/
VSCode.DebugAdapter
/
ServerProcess.cs
Copy path
More file actions
More file actions
Latest commit
History
History
History
112 lines (95 loc) · 4.1 KB
Breadcrumbs
OneScript
/
src
/
VSCode.DebugAdapter
/
ServerProcess.cs
Copy path
File metadata and controls
112 lines (95 loc) · 4.1 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/*----------------------------------------------------------
This Source Code Form is subject to the terms of the
Mozilla Public License, v.2.0. If a copy of the MPL
was not distributed with this file, You can obtain one
at http://mozilla.org/MPL/2.0/.
----------------------------------------------------------*/
using
System
.
Collections
.
Generic
;
using
System
.
Diagnostics
;
using
System
.
IO
;
using
Newtonsoft
.
Json
.
Linq
;
namespace
VSCode
.
DebugAdapter
{
internal
class
ServerProcess
:
DebugeeProcess
{
public
ServerProcess
(
PathHandlingStrategy
pathHandling
)
:
base
(
pathHandling
)
{
}
public
string
RuntimeExecutable
{
get
;
set
;
}
public
string
RuntimeArguments
{
get
;
set
;
}
public
string
WorkingDirectory
{
get
;
set
;
}
public
IDictionary
<
string
,
string
>
Environment
{
get
;
set
;
}
=
new
Dictionary
<
string
,
string
>
(
)
;
protected
override
Process
CreateProcess
(
)
{
var
dbgArgs
=
new
List
<
string
>
(
)
;
if
(
DebugPort
!=
0
)
{
dbgArgs
.
Add
(
$
"--debug.port=
{
DebugPort
}
"
)
;
}
dbgArgs
.
Add
(
"--debug.protocol=tcp"
)
;
dbgArgs
.
Add
(
$
"--debug.wait=
{
(
WaitOnStart
?
"1"
:
"0"
)
}
"
)
;
var
debugArguments
=
string
.
Join
(
" "
,
dbgArgs
)
;
var
process
=
new
Process
(
)
;
var
psi
=
process
.
StartInfo
;
psi
.
FileName
=
RuntimeExecutable
;
psi
.
UseShellExecute
=
false
;
psi
.
Arguments
=
$
"
{
debugArguments
}
{
RuntimeArguments
}
"
;
psi
.
WorkingDirectory
=
WorkingDirectory
;
psi
.
RedirectStandardError
=
true
;
psi
.
RedirectStandardOutput
=
true
;
LoadEnvironment
(
psi
,
Environment
)
;
return
process
;
}
protected
override
void
InitInternal
(
JObject
args
)
{
var
options
=
args
.
ToObject
<
WebLaunchOptions
>
(
)
;
// validate argument 'cwd'
var
workingDirectory
=
options
.
AppDir
;
if
(
workingDirectory
!=
null
)
{
workingDirectory
=
workingDirectory
.
Trim
(
)
;
if
(
workingDirectory
.
Length
==
0
)
{
throw
new
InvalidDebugeeOptionsException
(
3003
,
"Property 'cwd' is empty."
)
;
}
workingDirectory
=
ConvertClientPathToDebugger
(
workingDirectory
)
;
if
(
!
Directory
.
Exists
(
workingDirectory
)
)
{
throw
new
InvalidDebugeeOptionsException
(
3004
,
$
"Working directory '
{
workingDirectory
}
' does not exist."
)
;
}
}
else
{
throw
new
InvalidDebugeeOptionsException
(
3004
,
"Application directory 'appDir' is not specified."
)
;
}
options
.
AppDir
=
workingDirectory
;
// Кодировка DAP
SetEncoding
(
options
.
OutputEncoding
)
;
// validate argument 'runtimeExecutable'
var
runtimeExecutable
=
options
.
RuntimeExecutable
;
if
(
runtimeExecutable
!=
null
)
{
runtimeExecutable
=
runtimeExecutable
.
Trim
(
)
;
if
(
runtimeExecutable
.
Length
==
0
)
{
throw
new
InvalidDebugeeOptionsException
(
3005
,
"Property 'runtimeExecutable' is empty."
)
;
}
runtimeExecutable
=
ConvertClientPathToDebugger
(
runtimeExecutable
)
;
if
(
!
File
.
Exists
(
runtimeExecutable
)
)
{
throw
new
InvalidDebugeeOptionsException
(
3006
,
$
"Runtime executable '
{
runtimeExecutable
}
' does not exist."
)
;
}
}
else
{
throw
new
InvalidDebugeeOptionsException
(
3004
,
"Runtime executable 'runtimeExecutable' is not specified."
)
;
}
RuntimeExecutable
=
runtimeExecutable
;
RuntimeArguments
=
Utilities
.
ConcatArguments
(
options
.
RuntimeArgs
)
;
WorkingDirectory
=
options
.
AppDir
;
DebugPort
=
options
.
DebugPort
;
Environment
=
options
.
Env
;
WaitOnStart
=
options
.
WaitOnStart
;
}
}
}
Back
|
FazBrowse Home
|
New Git URL