on runtime python, also use assertProcess for convertToHscript()

This commit is contained in:
2021-08-01 20:03:22 -06:00
parent e3358c72bb
commit 4914eda951

View File

@@ -368,11 +368,11 @@ class Prelude {
* So don't use raw string literals in Kiss you want parsed and evaluated at runtime. * So don't use raw string literals in Kiss you want parsed and evaluated at runtime.
*/ */
public static function convertToHScript(kissStr:String):String { public static function convertToHScript(kissStr:String):String {
#if (!macro && hxnodejs) #if (!macro && (hxnodejs || python))
var kissProcess = ChildProcess.spawnSync("haxelib", ["run", "kiss", "convert", "--all", "--hscript"], {input: '${kissStr}\n'}); var hscript = try {
if (kissProcess.status != 0) { assertProcess("haxelib", ["run", "kiss", "convert", "--all", "--hscript"], kissStr.split('\n'));
var error:Buffer = kissProcess.stderr; } catch (e) {
throw 'failed to convert ${kissStr} to hscript: ${error.toString()}'; throw 'failed to convert ${kissStr} to hscript:\n$e';
} }
var output:Buffer = kissProcess.stdout; var output:Buffer = kissProcess.stdout;
return output.toString(); return output.toString();