aboutsummaryrefslogtreecommitdiff
path: root/src/compileAndRun/index.js
diff options
context:
space:
mode:
authorJakob Stendahl <14180120+JakobST1n@users.noreply.github.com>2021-10-11 20:02:04 +0200
committerGitHub <noreply@github.com>2021-10-11 20:02:04 +0200
commitc67531161e56488166a33232f87566309ba8676e (patch)
tree846e59a020e80bea48557d5a06af5728e44961ff /src/compileAndRun/index.js
parente6880cd8ccf82d993f222cb14b4860581654acb8 (diff)
parentc1b6eec770b885a9829e1f62bad5cc99389ca429 (diff)
downloadLuxcena-Neo-c67531161e56488166a33232f87566309ba8676e.tar.gz
Luxcena-Neo-c67531161e56488166a33232f87566309ba8676e.zip
Merge pull request #24 from JakobST1n/rebuild
v1.0.0
Diffstat (limited to 'src/compileAndRun/index.js')
-rw-r--r--src/compileAndRun/index.js75
1 files changed, 0 insertions, 75 deletions
diff --git a/src/compileAndRun/index.js b/src/compileAndRun/index.js
deleted file mode 100644
index 6f89e44..0000000
--- a/src/compileAndRun/index.js
+++ /dev/null
@@ -1,75 +0,0 @@
-let EventEmitter = require('events');
-let fse = require("fs-extra");
-let Process = require("./process");
-let pythonSupportFiles = __dirname + "/pythonSupportFiles/";
-
-class Python extends EventEmitter {
-
- constructor(profileFolder, usrDataFolder) {
- super();
- this.profileFolder = profileFolder;
- this.usrDataFolder = usrDataFolder;
-
- this.stdout = "";
- this.stderr = "";
- }
-
- status() {
- return {};
- }
-
- compile() {
- try {
- fse.removeSync(this.profileFolder + "/build");
- fse.copySync(pythonSupportFiles, this.profileFolder + "/build/");
- fse.copySync(this.profileFolder + "/script.py", this.profileFolder + "/build/script.py");
- } catch (err) {
- console.log(err);
- }
- }
-
- run() {
- // Setup paths and commands
- let entryPath = this.profileFolder + "/build/entry.py";
-
- // Spawn the new process
- this.pyProc = new Process("python", [
- "-u", // This makes us able to get real-time output
- entryPath, // This is where the entry-point is located
- this.usrDataFolder // This is required for the python-script to now where our config-files are
- ]);
- this.pyProc.start();
-
- this.pyProc.proc.stdout.on("data", (_stdout) => {
- this.emit("stdout::data", "" + _stdout);
- });
- this.pyProc.proc.stdout.on("end", () => {
- this.emit("stdout::end");
- });
- this.pyProc.proc.stderr.on("data", (_stderr) => {
- this.emit("stderr::data", _stderr);
- });
- this.pyProc.proc.stderr.on("end", () => {
- this.emit("stderr:end");
- });
- this.pyProc.proc.on("close", (_code) => {
- this.emit("close", _code);
- });
-
- }
-
- compileAndRun() {
- this.compile();
- this.run();
- }
-
- stop() {
- this.pyProc.proc.kill("SIGINT");
- }
-
-}
-
-module.exports = {
- Python: Python,
- Process: Process
-};