Skip to content

Commit cb57356

Browse files
committed
add bash support
1 parent e91a84f commit cb57356

File tree

5 files changed

+13
-7
lines changed

5 files changed

+13
-7
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ const options = {
7373
cee.execute("print('Hi!')", cee.languages.PYTHON3, options);
7474
```
7575

76+
#### LXC
77+
78+
LXC are Linux containers, that run the code in a different and secure environment. To use them, you need to install them first. LXC are only available on Linux-Systems.
79+
7680
<a name="contributing"/>
7781

7882
## Contributing

runners/linux/bash.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
timeout -s SIGKILL 10 bash $1

src/executor.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const uniqueFilename = require("unique-filename");
77

88
interface ISecurity {
99
enabled?: boolean;
10-
uselxc?: boolean;
10+
useLXC?: boolean;
1111
timeout?: number;
1212
}
1313

@@ -19,12 +19,14 @@ interface IOptions {
1919
*
2020
* @param input The code that should be executed
2121
* @param language Language of the input parameter
22+
* @param args Array of arguments to run the code
2223
* @param options Options Parameter
2324
* @returns Result of the code
2425
*/
2526
export default async function execute(
2627
input: string,
2728
language: Language,
29+
args?: [string],
2830
options?: IOptions
2931
): Promise<string> {
3032
// Check Platform

src/languages.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
enum Language {
22
PYTHON3 = "python3",
33
C = "gcc",
4+
BASH = "bash",
45
}
56

67
export default Language;

test/test.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
var cee = require("../lib/index");
22
(async () => {
33
var r = await cee.execute(
4-
`#include <stdio.h>
5-
int main() {
6-
printf("Hello, test123!");
7-
return 0;
8-
}
4+
`
5+
echo 123
96
`,
10-
cee.languages.C,
7+
cee.languages.BASH,
118
{
129
security: {
1310
enabled: false,

0 commit comments

Comments
 (0)