Skip to content

Instantly share code, notes, and snippets.

@terurou
Last active October 4, 2017 15:05
Show Gist options
  • Save terurou/2cf15e3edbb78335be2fb7e8e92ea783 to your computer and use it in GitHub Desktop.
Save terurou/2cf15e3edbb78335be2fb7e8e92ea783 to your computer and use it in GitHub Desktop.
マクロから外部プロセス起動の基本形
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