Skip to content

Instantly share code, notes, and snippets.

@terurou

terurou/SampleMacro.hx

Last active Oct 4, 2017
Embed
What would you like to do?
マクロから外部プロセス起動の基本形
import sys.io.Process;
import haxe.io.Eor;
class SampleMacro {
public static macro function run(): Void {
var process = new Process("node compiler.js");
try {
process.stdout.readLine();
process.close();
} catch (e: Eof) {
process.close();
var detail = [];
try {
while (true) detail.push(process.stderr.readLine());
} catch (_: Eof) {}
throw "can not start process:\n" + detail.join("\n");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment