diff --git a/gclc.system/.gitignore b/gclc.system/.gitignore
new file mode 100644
index 0000000..d98981c
--- /dev/null
+++ b/gclc.system/.gitignore
@@ -0,0 +1,4 @@
+/target/
+/.classpath
+/.project
+/.settings/
diff --git a/gclc.system/pom.xml b/gclc.system/pom.xml
new file mode 100644
index 0000000..c3b3e56
--- /dev/null
+++ b/gclc.system/pom.xml
@@ -0,0 +1,41 @@
+
+ * TODO
+ *
+ * @author Emmanuel Bigeon */
+public class ExecSystemCommand extends Command {
+
+ private static final String EOL = System.lineSeparator();
+ /** The class logger */
+ private static final Logger LOGGER = Logger
+ .getLogger(ExecSystemCommand.class.getName());
+ private final ConsoleManager manager;
+
+ /** @param name
+ * @param manager */
+ public ExecSystemCommand(String name, ConsoleManager manager) {
+ super(name);
+ this.manager = manager;
+ }
+
+ /** @param name
+ * @param manager */
+ public ExecSystemCommand(ConsoleManager manager) {
+ super("exec");
+ this.manager = manager;
+ }
+
+ /* (non-Javadoc)
+ * @see fr.bigeon.gclc.command.ICommand#execute(java.lang.String[]) */
+ @Override
+ public void execute(String... args) throws CommandRunException {
+ Process proc;
+ try {
+ proc = Runtime.getRuntime().exec(args);
+ } catch (IOException e2) {
+ LOGGER.log(Level.SEVERE, "Unable to run process", e2);
+ return;
+ }
+
+ final InputStream is = proc.getInputStream();
+ Thread th = new Thread(new Runnable() {
+
+ @Override
+ public void run() {
+ try {
+ readToEnd(is);
+ } catch (CommandRunException e) {
+ LOGGER.log(Level.WARNING,
+ "Manager was closed in the meantime...", e);
+ }
+ }
+ });
+ th.start();
+ manager.setPrompt("");
+ final OutputStream os = proc.getOutputStream();
+ try (BufferedWriter writer = new BufferedWriter(
+ new OutputStreamWriter(os))) {
+ while (th.isAlive()) {
+ String user;
+ try {
+ user = manager.prompt();
+ } catch (IOException e) {
+ throw new CommandRunException(
+ CommandRunExceptionType.INTERACTION,
+ "manager was closed", e, this);
+ }
+ writer.write(user + EOL);
+ }
+ } catch (IOException e1) {
+ // TODO Auto-generated catch block
+ e1.printStackTrace();
+ }
+ }
+
+ /** @param is the input stream
+ * @throws CommandRunException */
+ protected void readToEnd(InputStream is) throws CommandRunException {
+ int c;
+ try {
+ while ((c = is.read()) != -1) {
+ try {
+ manager.print(Character.valueOf((char) c).toString());
+ } catch (IOException e) {
+ throw new CommandRunException(
+ CommandRunExceptionType.INTERACTION,
+ "manager was closed", e, this);
+ }
+ }
+ } catch (IOException e) {
+ LOGGER.log(Level.INFO, "input stream reading failed", e);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see fr.bigeon.gclc.command.Command#usageDetail() */
+ @Override
+ protected String usageDetail() {
+ return " The system command is a system dependend command like sh on linux or" +
+ System.lineSeparator() + "powershell on windows." +
+ System.lineSeparator() + System.lineSeparator() +
+ " As an example if you give \"cat /etc/hostname\" as argument, on a linux" +
+ System.lineSeparator() +
+ "system, you would get the computer name." +
+ System.lineSeparator();
+ }
+
+ /* (non-Javadoc)
+ * @see fr.bigeon.gclc.command.Command#usagePattern() */
+ @Override
+ protected String usagePattern() {
+ return " CMD