mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-06 03:20:13 +08:00
feat: capture output and exit code of commands
+ ignore interactive commands like vim, top or nano
This commit is contained in:
1 parent
d997a061a9
commit
b9643e7d5c
4 files changed
+25
-5
No files matched your search
@@ -5,7 +5,7 @@ import { verifySessionJWT } from '../../utils/auth.js'
|
||||
|
||||
export async function newCommand(req, res) {
|
||||
console.log('new command:', req.body)
|
||||
const { token, command, pwd, output } = req.body
|
||||
const { token, command, pwd, exit_code, output } = req.body
|
||||
|
||||
let sessionId
|
||||
try {
|
||||
@@ -27,6 +27,7 @@ export async function newCommand(req, res) {
|
||||
session,
|
||||
command,
|
||||
pwd,
|
||||
exit_code,
|
||||
output,
|
||||
})
|
||||
|
||||
|
||||
@@ -17,6 +17,10 @@ const Command = model(
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
exit_code: {
|
||||
type: Number,
|
||||
required: false,
|
||||
},
|
||||
output: {
|
||||
type: String,
|
||||
required: false,
|
||||
|
||||
Reference in new issue
Block a user