diff --git a/tools/create_package.py b/tools/create_package.py index fc7e663..13a4173 100644 --- a/tools/create_package.py +++ b/tools/create_package.py @@ -19,20 +19,19 @@ def GetVersion (rootDir): return packageJson['version'] def JSHintFolder (folder): - result = Tools.RunCommand (['jshint', folder]) + result = Tools.RunCommand ('jshint', [folder]) if result != 0: return False return True def CompressFiles (inputFiles, outputFile): parameters = [] - parameters.append ('google-closure-compiler') for inputFile in inputFiles: extension = os.path.splitext (inputFile)[1] if extension == '.js': parameters.append ('--js=' + os.path.join ('..', inputFile)) parameters.append ('--js_output_file=' + outputFile) - result = Tools.RunCommand (parameters) + result = Tools.RunCommand ('google-closure-compiler', parameters) if result != 0: return False return True diff --git a/tools/lib/tools_lib.py b/tools/lib/tools_lib.py index c8f8337..9951238 100644 --- a/tools/lib/tools_lib.py +++ b/tools/lib/tools_lib.py @@ -13,13 +13,9 @@ def WriteContentToFile (filePath, content): fileObject.write (content) fileObject.close () -def RunCommand (commands): - process = subprocess.Popen (commands, stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell = True) - out, err = process.communicate () - if process.returncode != 0: - print (out.decode ()) - print (err.decode ()) - return process.returncode +def RunCommand (executable, arguments): + command = executable + ' "' + '" "'.join (arguments) + '"' + return os.system (command) class TokenReplacer: def __init__ (self, filePath, keepToken): diff --git a/tools/optimize_svg_files.py b/tools/optimize_svg_files.py index c6f7c10..33b653a 100644 --- a/tools/optimize_svg_files.py +++ b/tools/optimize_svg_files.py @@ -7,8 +7,7 @@ def Main (argv): currentDir = os.path.dirname (os.path.abspath (__file__)) os.chdir (currentDir) imagesPath = os.path.abspath (os.path.join ('..', 'website', 'assets', 'images')) - for i in range (0, 5): - Tools.RunCommand (['svgo', '-r', imagesPath]) + Tools.RunCommand ('svgo', ['-r', imagesPath]) return 0 sys.exit (Main (sys.argv))