From 6baf5b4767d676f812dc6e8e0eb7a81d1e39181b Mon Sep 17 00:00:00 2001 From: Viktor Kovacs Date: Wed, 12 May 2021 20:09:52 +0200 Subject: [PATCH] Run the correct python version with a node.js script. --- package.json | 6 +++--- tools/run_python.js | 13 +++++++++++++ 2 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 tools/run_python.js diff --git a/package.json b/package.json index 85d68d1..2121fa5 100644 --- a/package.json +++ b/package.json @@ -15,8 +15,8 @@ "scripts": { "test": "mocha test", "coverage": "nyc mocha test", - "build": "py -3 tools/create_package.py", - "update": "py -3 tools/update_includes.py", - "svg": "py -3 tools/optimize_svg_files.py" + "build": "node tools/run_python.js tools/create_package.py", + "update": "node tools/run_python.js tools/update_includes.py", + "svg": "node tools/run_python.js tools/optimize_svg_files.py" } } diff --git a/tools/run_python.js b/tools/run_python.js new file mode 100644 index 0000000..e50ffb1 --- /dev/null +++ b/tools/run_python.js @@ -0,0 +1,13 @@ +let childProcess = require ('child_process'); + +let pythonExecutable = 'python'; +if (process.platform !== 'win32') { + pythonExecutable = 'python3'; +} + +let args = process.argv.slice (2); +let result = childProcess.spawnSync (pythonExecutable, args, { + stdio: "inherit" +}); + +process.exit (result.status);