Last active
October 4, 2017 15:05
-
-
Save terurou/2cf15e3edbb78335be2fb7e8e92ea783 to your computer and use it in GitHub Desktop.
マクロから外部プロセス起動の基本形
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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