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
a789fa7f
Commit
a789fa7f
authored
Dec 07, 2020
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
git return value insead of logging
parent
5c58b489
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
27 deletions
+23
-27
terminal.js
apps/remix-ide/src/app/panels/terminal.js
+5
-11
gitClient.ts
libs/remixd/src/services/gitClient.ts
+18
-16
No files found.
apps/remix-ide/src/app/panels/terminal.js
View file @
a789fa7f
...
...
@@ -103,13 +103,7 @@ class Terminal extends Plugin {
})
this
.
on
(
'scriptRunner'
,
'error'
,
(
msg
)
=>
{
this
.
commands
.
error
.
apply
(
this
.
commands
,
msg
.
data
)
})
this
.
on
(
'git'
,
'log'
,
(
result
)
=>
{
this
.
commands
.
html
(
yo
`<pre>
${
result
}
</pre>`
)
})
this
.
on
(
'git'
,
'error'
,
(
result
)
=>
{
this
.
commands
.
html
(
yo
`<pre>
${
result
}
</pre>`
)
})
})
}
onDeactivation
()
{
...
...
@@ -117,8 +111,6 @@ class Terminal extends Plugin {
this
.
off
(
'scriptRunner'
,
'info'
)
this
.
off
(
'scriptRunner'
,
'warn'
)
this
.
off
(
'scriptRunner'
,
'error'
)
this
.
off
(
'git'
,
'log'
)
this
.
off
(
'git'
,
'error'
)
}
logHtml
(
html
)
{
...
...
@@ -755,11 +747,13 @@ class Terminal extends Plugin {
}
}
try
{
let
result
if
(
script
.
trim
().
startsWith
(
'git'
))
{
await
this
.
call
(
'git'
,
'execute'
,
script
)
result
=
await
this
.
call
(
'git'
,
'execute'
,
script
)
}
else
{
await
this
.
call
(
'scriptRunner'
,
'execute'
,
script
)
result
=
await
this
.
call
(
'scriptRunner'
,
'execute'
,
script
)
}
if
(
result
)
self
.
commands
.
html
(
yo
`<pre>
${
result
}
</pre>`
)
done
()
}
catch
(
error
)
{
done
(
error
.
message
||
error
)
...
...
libs/remixd/src/services/gitClient.ts
View file @
a789fa7f
...
...
@@ -17,22 +17,24 @@ export class GitClient extends PluginClient {
this
.
readOnly
=
readOnly
}
execute
(
cmd
:
string
)
{
assertCommand
(
cmd
)
const
options
=
{
cwd
:
this
.
currentSharedFolder
,
shell
:
true
}
const
child
=
spawn
(
cmd
,
options
)
let
result
=
''
let
error
=
''
child
.
stdout
.
on
(
'data'
,
(
data
)
=>
{
result
+=
data
.
toString
()
})
child
.
stderr
.
on
(
'data'
,
(
err
)
=>
{
error
+=
err
.
toString
()
})
child
.
on
(
'close'
,
()
=>
{
if
(
error
!==
''
)
this
.
emit
(
'error'
,
error
)
else
this
.
emit
(
'log'
,
result
)
})
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
()
})
child
.
stderr
.
on
(
'data'
,
(
err
)
=>
{
error
+=
err
.
toString
()
})
child
.
on
(
'close'
,
()
=>
{
if
(
error
)
reject
(
error
)
else
resolve
(
result
)
})
})
}
}
...
...
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