Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
baf86d90
Commit
baf86d90
authored
Dec 01, 2020
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor
parent
850d85fb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
13 deletions
+5
-13
gitClient.ts
libs/remixd/src/services/gitClient.ts
+5
-13
No files found.
libs/remixd/src/services/gitClient.ts
View file @
baf86d90
...
...
@@ -17,18 +17,13 @@ export class GitClient extends PluginClient {
this
.
readOnly
=
readOnly
}
command
(
cmd
:
string
)
{
return
new
Promise
((
resolve
,
reject
)
=>
{
try
{
try
{
validateCommand
(
cmd
,
gitRegex
)
}
catch
(
e
)
{
return
reject
(
e
)
}
execute
(
cmd
:
string
)
{
assertCommand
(
cmd
)
const
options
=
{
cwd
:
this
.
currentSharedFolder
,
shell
:
true
}
const
child
=
spawn
(
cmd
,
options
)
let
result
=
''
let
error
=
''
return
new
Promise
((
resolve
,
reject
)
=>
{
child
.
stdout
.
on
(
'data'
,
(
data
)
=>
{
result
+=
data
.
toString
()
})
...
...
@@ -42,9 +37,6 @@ export class GitClient extends PluginClient {
resolve
(
result
+
error
)
}
})
}
catch
(
e
)
{
reject
(
e
)
}
})
}
}
...
...
@@ -52,9 +44,9 @@ export class GitClient extends PluginClient {
/**
* Validate that command can be run by service
* @param cmd
* @param regex
*/
function
validateCommand
(
cmd
,
regex
)
{
function
assertCommand
(
cmd
)
{
const
regex
=
'^git
\\
s[^&|;]*$'
if
(
!
RegExp
(
regex
).
test
(
cmd
))
{
// git then space and then everything else
throw
new
Error
(
'Invalid command for service!'
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment