FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
hlambda-cli/src/utils/executeShellCommandClass.js at v0.0.12 · hlambda/hlambda-cli · GitHub
hlambda
hlambda-cli
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
hlambda-cli
/
src
/
utils
/
executeShellCommandClass.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
31 lines (27 loc) · 780 Bytes
Breadcrumbs
hlambda-cli
/
src
/
utils
/
executeShellCommandClass.js
Copy path
File metadata and controls
31 lines (27 loc) · 780 Bytes
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
import
fetch
from
'node-fetch'
;
export
const
executeShellCommandClass
=
(
adminSecret
,
endpoint
,
silent
=
false
)
=>
async
(
command
,
cwd
)
=>
{
const
headers
=
{
'x-hlambda-admin-secret'
:
adminSecret
,
Accept
:
'application/json'
,
'Content-Type'
:
'application/json'
,
// Important
}
;
const
response
=
await
fetch
(
`
${
endpoint
}
/console/api/v1/command-request`
,
{
method
:
'POST'
,
// Important
body
:
JSON
.
stringify
(
{
command
,
cwd
,
}
)
,
headers
,
}
)
;
if
(
!
silent
)
{
if
(
response
.
status
===
200
)
{
console
.
log
(
`Shell command`
.
green
,
`
${
command
}
`
.
red
,
`executed!`
.
green
)
;
}
console
.
log
(
response
.
status
)
;
}
return
response
;
}
;
export
default
executeShellCommandClass
;
Back
|
FazBrowse Home
|
New Git URL