mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-09 19:45:13 +02:00
[pitboss] phase 14: Track B — Java harness emitter shapes
This commit is contained in:
parent
7628c48930
commit
bd1bd0ce84
36 changed files with 1793 additions and 155 deletions
|
|
@ -0,0 +1,26 @@
|
|||
// Phase 14 fixture stub — Spring-injected helper service.
|
||||
// The fixture's controller declares `@Autowired CommandRunner runner;`
|
||||
// so the harness exercises the Phase 09 import-extraction path
|
||||
// (`@Autowired` is the marker that flags `org.springframework` as a
|
||||
// transitive dep). At runtime the harness instantiates the controller
|
||||
// via reflection's default ctor — the @Autowired field stays null
|
||||
// because there is no Spring container; the controller's handler
|
||||
// guards against null and constructs a fresh CommandRunner on demand.
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
public class CommandRunner {
|
||||
public String run(String cmd) throws Exception {
|
||||
Process p = Runtime.getRuntime().exec(new String[] {"/bin/sh", "-c", cmd});
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
||||
StringBuilder out = new StringBuilder();
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
out.append(line);
|
||||
out.append('\n');
|
||||
}
|
||||
p.waitFor();
|
||||
return out.toString();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue