Skip to content

Commit f8da8ac

Browse files
authored
Added batch support and removed command check
2 parents ebbe905 + 19b0876 commit f8da8ac

File tree

5 files changed

+6
-8
lines changed

5 files changed

+6
-8
lines changed

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg)](https://GitHub.com/simonkoeck/code-execution-engine/graphs/commit-activity) [![Ask Me Anything !](https://img.shields.io/badge/Ask%20me-anything-1abc9c.svg)](https://GitHub.com/simonkoeck) [![GitHub license](https://img.shields.io/github/license/simonkoeck/code-execution-engine)](https://github.com/simonkoeck/code-execution-engine/blob/master/LICENSE) [![GitHub contributors](https://img.shields.io/github/contributors/simonkoeck/code-execution-engine)](https://GitHub.com/simonkoeck/code-execution-engine)
1+
[![Maintenance](https://img.shields.io/badge/Maintained%3F-yes-green.svg?style=for-the-badge)](https://GitHub.com/simonkoeck/code-execution-engine/graphs/commit-activity) [![Ask Me Anything !](https://img.shields.io/badge/Ask%20me-anything-1abc9c.svg?style=for-the-badge)](https://GitHub.com/simonkoeck) [![GitHub license](https://img.shields.io/github/license/simonkoeck/code-execution-engine?style=for-the-badge)](https://github.com/simonkoeck/code-execution-engine/blob/master/LICENSE) [![GitHub contributors](https://img.shields.io/github/contributors/simonkoeck/code-execution-engine?style=for-the-badge)](https://GitHub.com/simonkoeck/code-execution-engine)
22

33
# Code-Execution-Engine
44

@@ -54,6 +54,7 @@ cee
5454
## Supported Languages
5555

5656
- **Python3** (Windows / Linux)
57+
- **Batch** (Windows)
5758
- **Bash** (Linux)
5859
- **C** (Linux)
5960

package.json

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
},
3131
"homepage": "https://github.com/simonkoeck/code-execution-engine#readme",
3232
"dependencies": {
33-
"command-exists": "^1.2.9",
3433
"unique-filename": "^1.1.1"
3534
}
3635
}

runners/win32/bat.bat

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@echo off
2+
%1

src/executor.ts

+1-6
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { platform, tmpdir } from "os";
22
import { writeFileSync, unlinkSync, mkdirSync, readFileSync } from "fs";
33
import { exec } from "child_process";
44
import Language from "./languages";
5-
import { sync as commandExists } from "command-exists";
65
import path from "path";
76

87
const uniqueFilename = require("unique-filename");
@@ -30,14 +29,10 @@ export default async function execute(
3029
throw Error("Your OS is not supported yet.");
3130
}
3231

33-
// Check if Command Exists
34-
if (!commandExists(language)) {
35-
throw new Error("This language is not installed on the machine");
36-
}
37-
3832
// Write File to temp folder
3933
var temppath: string = uniqueFilename(tmpdir());
4034
if (language == Language.C) temppath += ".c";
35+
else if (language == Language.BATCH) temppath += ".bat";
4136
writeFileSync(temppath, input, { encoding: "utf-8" });
4237

4338
// Command to execute runner

src/languages.ts

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ enum Language {
22
PYTHON3 = "python3",
33
C = "gcc",
44
BASH = "bash",
5+
BATCH = "bat"
56
}
67

78
export default Language;

0 commit comments

Comments
 (0)