sync: wip changes
This commit is contained in:
@@ -3,17 +3,19 @@ import type { SimpleStream } from '../utils/SimpleStream'
|
||||
import { Program } from './Program'
|
||||
|
||||
export class Eval extends Program {
|
||||
async Exec(_: SimpleStream<string>, stdout: SimpleStream<string>, _workdir: Item, args: string[]): Promise<number> {
|
||||
const javascript = args.slice(1).join(' ')
|
||||
async Exec(stdin: SimpleStream<string>, stdout: SimpleStream<string>, _workdir: Item, args: string[]): Promise<number> {
|
||||
let javascript: string = args.slice(1).join(' ')
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
private RunJs(javascript: string, stdout: SimpleStream<string>) {
|
||||
try {
|
||||
// todo: pass workdir to the program
|
||||
eval(javascript)
|
||||
} catch (e) {
|
||||
stdout.emit(`${String(e)}\n`)
|
||||
return 1
|
||||
throw e
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user