Update index.js
Browse files
index.js
CHANGED
|
@@ -102,7 +102,6 @@ app.all('/', async (req, res) => {
|
|
| 102 |
}
|
| 103 |
})
|
| 104 |
|
| 105 |
-
//const execPromise = promisify(exec)
|
| 106 |
app.get(
|
| 107 |
'/shell',
|
| 108 |
(req, res, next) => {
|
|
@@ -117,8 +116,8 @@ app.get(
|
|
| 117 |
async (req, res) => {
|
| 118 |
const [cmd, ...args] = req
|
| 119 |
.query
|
| 120 |
-
.cmd
|
| 121 |
-
|
| 122 |
.split(' ')
|
| 123 |
const file = format(
|
| 124 |
'%s/%s.log',
|
|
@@ -134,6 +133,7 @@ app.get(
|
|
| 134 |
args,
|
| 135 |
{
|
| 136 |
detached: true,
|
|
|
|
| 137 |
stdio: ['ignore', log, log]
|
| 138 |
}
|
| 139 |
)
|
|
|
|
| 102 |
}
|
| 103 |
})
|
| 104 |
|
|
|
|
| 105 |
app.get(
|
| 106 |
'/shell',
|
| 107 |
(req, res, next) => {
|
|
|
|
| 116 |
async (req, res) => {
|
| 117 |
const [cmd, ...args] = req
|
| 118 |
.query
|
| 119 |
+
.cmd
|
| 120 |
+
?.trim()
|
| 121 |
.split(' ')
|
| 122 |
const file = format(
|
| 123 |
'%s/%s.log',
|
|
|
|
| 133 |
args,
|
| 134 |
{
|
| 135 |
detached: true,
|
| 136 |
+
shell: true,
|
| 137 |
stdio: ['ignore', log, log]
|
| 138 |
}
|
| 139 |
)
|