MCPcopy Create free account
hub / github.com/DeNA/PacketProxy / executeExe

Method executeExe

src/main/java/core/packetproxy/common/Utils.java:151–172  ·  view source on GitHub ↗

EXEを実行する。MACの場合はmonoで実行する @return 標準出力に表示されたデータ

(String... command)

Source from the content-addressed store, hash-verified

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>();

Callers

nothing calls this directly

Calls 8

addMonoPathMethod · 0.95
errMethod · 0.80
getInputStreamMethod · 0.65
writeMethod · 0.65
readMethod · 0.45
sizeMethod · 0.45
toStringMethod · 0.45
toByteArrayMethod · 0.45

Tested by

no test coverage detected