EXEを実行する。MACの場合はmonoで実行する @return 標準出力に表示されたデータ
(String... command)
| 149 | * @return 標準出力に表示されたデータ |
| 150 | */ |
| 151 | public static byte[] executeExe(String... command) throws Exception { |
| 152 | Process p = Runtime.getRuntime().exec(addMonoPath(command)); |
| 153 | InputStream in = p.getInputStream(); |
| 154 | ByteArrayOutputStream bout = new ByteArrayOutputStream(); |
| 155 | byte[] buffer = new byte[4096]; |
| 156 | int len = 0; |
| 157 | while ((len = in.read(buffer, 0, 4096)) > 0) { |
| 158 | |
| 159 | bout.write(buffer, 0, len); |
| 160 | } |
| 161 | InputStream err = p.getErrorStream(); |
| 162 | ByteArrayOutputStream berr = new ByteArrayOutputStream(); |
| 163 | while ((len = err.read(buffer, 0, 4096)) > 0) { |
| 164 | |
| 165 | berr.write(buffer, 0, len); |
| 166 | } |
| 167 | if (berr.size() > 0) { |
| 168 | |
| 169 | err(berr.toString()); |
| 170 | } |
| 171 | return bout.toByteArray(); |
| 172 | } |
| 173 | |
| 174 | private static String[] addRubyPath(String... args) { |
| 175 | List<String> cmd_array = new ArrayList<String>(); |
nothing calls this directly
no test coverage detected