diff --git a/ADSMSettings/management/commands/compilestatic.py b/ADSMSettings/management/commands/compilestatic.py index 1b654abae..7443735af 100644 --- a/ADSMSettings/management/commands/compilestatic.py +++ b/ADSMSettings/management/commands/compilestatic.py @@ -1,5 +1,6 @@ import subprocess import os +import platform from django.core.management import BaseCommand, call_command from django.conf import settings @@ -32,7 +33,7 @@ def handle(self, *args, **options): os.chdir(settings.BASE_DIR) command_path = os.path.join('.', 'node_modules', '.bin', 'webpack') - command = command_path + ' --config %s' % config_file - webpack = subprocess.Popen(command, cwd=os.path.join(settings.BASE_DIR), shell=True) + command = [command_path, '--config %s' % config_file] + webpack = subprocess.Popen(command, cwd=os.path.join(settings.BASE_DIR), shell=(platform.system() != 'Darwin')) webpack.communicate() # Wait for webpack to finish compile call_command('collectstatic') diff --git a/ADSMSettings/management/commands/devserver.py b/ADSMSettings/management/commands/devserver.py index 4e69d8b98..2d9df20ac 100644 --- a/ADSMSettings/management/commands/devserver.py +++ b/ADSMSettings/management/commands/devserver.py @@ -1,5 +1,6 @@ import subprocess import os +import platform from django.core.management import BaseCommand, call_command from django.conf import settings @@ -30,6 +31,6 @@ def handle(self, *args, **options): config_file = 'webpack.config.js' command_path = os.path.join('.', 'node_modules', '.bin', 'webpack') - command = command_path + ' --config %s --watch' % config_file - webpack = subprocess.Popen(command, cwd=os.path.join(settings.BASE_DIR), shell=True) + command = [command_path, '--config %s --watch' % config_file] + webpack = subprocess.Popen(command, cwd=os.path.join(settings.BASE_DIR), shell=(platform.system() != 'Darwin')) call_command('runserver') diff --git a/ADSMSettings/utils.py b/ADSMSettings/utils.py index 4ed2af3c3..902e863a3 100644 --- a/ADSMSettings/utils.py +++ b/ADSMSettings/utils.py @@ -316,7 +316,7 @@ def launch_external_program_and_exit(launch, code=0, close_self=True, cmd_args=N else: launch_args.update(preexec_fn=os.setsid) launch_args.update(start_new_session=True) - subprocess.Popen(launch, stdin=subprocess.PIPE, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **launch_args) + subprocess.Popen(launch, stdin=subprocess.PIPE, shell=(platform.system() != 'Darwin'), stdout=subprocess.PIPE, stderr=subprocess.PIPE, **launch_args) if close_self: sys.exit(code) @@ -327,7 +327,7 @@ def check_simulation_version(): version = None try: executable = adsm_executable_command()[0] - process = subprocess.Popen(executable + " --version --silent", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + process = subprocess.Popen([executable, "--version --silent"], shell=(platform.system() != 'Darwin'), stdout=subprocess.PIPE, stderr=subprocess.PIPE) try: output, error = process.communicate(timeout=200) exit_code = process.returncode @@ -356,7 +356,7 @@ def npu_update_info(): new_version = None try: npu = os.path.join(settings.BASE_DIR, 'npu'+settings.EXTENSION) - process = subprocess.Popen(npu + " --check_update --silent", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + process = subprocess.Popen([npu, "--check_update", "--silent"], shell=(platform.system() != 'Darwin'), stdout=subprocess.PIPE, stderr=subprocess.PIPE) try: output, error = process.communicate(timeout=60000) exit_code = process.returncode diff --git a/setup.py b/setup.py index 1c509cf34..0f7e009dc 100644 --- a/setup.py +++ b/setup.py @@ -2,6 +2,7 @@ import os import stat import pip +import platform import shutil import subprocess @@ -210,8 +211,9 @@ def run(self): print("Preparing to pack client files...") webpack_command_path = os.path.join('.', 'node_modules', '.bin', 'webpack') - webpack_command = webpack_command_path + ' --config webpack.config.js' - webpack = subprocess.Popen(webpack_command, cwd=os.path.join(settings.BASE_DIR), shell=True) + webpack_command = [webpack_command_path, '--config webpack.config.js'] + webpack = subprocess.Popen(webpack_command, cwd=os.path.join(settings.BASE_DIR), shell=(platform.system() != 'Darwin')) + print("Packing client files...") outs, errs = webpack.communicate() # TODO: Possible error checking print("Done packing.")