mirror of
https://github.com/engineer-man/piston.git
synced 2025-04-21 04:26:28 +02:00
Add stdin
This commit is contained in:
parent
8fd831982e
commit
c537cab2da
30 changed files with 42 additions and 32 deletions
|
@ -1,7 +1,7 @@
|
|||
const { writeFile } = require('fs/promises');
|
||||
const { spawn } = require('child_process');
|
||||
|
||||
function execute(language, source, args) {
|
||||
function execute(language, source, args, stdin) {
|
||||
return new Promise(async resolve => {
|
||||
const stamp = new Date().getTime();
|
||||
const sourceFile = `/tmp/${stamp}.code`;
|
||||
|
@ -11,6 +11,7 @@ function execute(language, source, args) {
|
|||
const process = spawn(__dirname + '/../lxc/execute', [
|
||||
language.name,
|
||||
sourceFile,
|
||||
stdin ?? '',
|
||||
args?.join('\n') ?? '',
|
||||
]);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue