package com.enot.cmd.core;

import org.zeroturnaround.exec.ProcessExecutor;
import org.zeroturnaround.exec.ProcessResult;
import org.zeroturnaround.exec.StartedProcess;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

final class BaseCommand implements Command {
    private final ProcessExecutor processExecutor;

    BaseCommand(ProcessExecutor processExecutor) {
        this.processExecutor = processExecutor;
    }

    /**
     * See {@link ProcessExecutor#execute()}
     */
    @Override
    public ProcessResult execute() throws IOException, TimeoutException, InterruptedException {
        return processExecutor.execute();
    }

    /**
     * See {@link ProcessExecutor#executeNoTimeout()}
     */
    @Override
    public ProcessResult executeNoTimeout() throws IOException, InterruptedException {
        return processExecutor.executeNoTimeout();
    }

    /**
     * See {@link ProcessExecutor#start()}
     */
    @Override
    public StartedProcess start() throws IOException {
        return processExecutor.start();
    }

    /**
     * Get the command line as a string
     * @return
     */
    @Override
    public String toString() {
        return String.join(" ", processExecutor.getCommand());
    }
}

package com.enot.cmd.core;

import org.zeroturnaround.exec.ProcessExecutor;
import org.zeroturnaround.exec.ProcessResult;
import org.zeroturnaround.exec.StartedProcess;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

final class BaseCommand implements Command {
    private final ProcessExecutor processExecutor;

    BaseCommand(ProcessExecutor processExecutor) {
        this.processExecutor = processExecutor;
    }

    /**
     * See {@link ProcessExecutor#execute()}
     */
    @Override
    public ProcessResult execute() throws IOException, TimeoutException, InterruptedException {
        return processExecutor.execute();
    }

    /**
     * See {@link ProcessExecutor#executeNoTimeout()}
     */
    @Override
    public ProcessResult executeNoTimeout() throws IOException, InterruptedException {
        return processExecutor.executeNoTimeout();
    }

    /**
     * See {@link ProcessExecutor#start()}
     */
    @Override
    public StartedProcess start() throws IOException {
        return processExecutor.start();
    }
}

Revert "Get the command line as a string"
Revert "Get the command line as a string"

This reverts commit 1f1400b9f9d3e76ab6b2242400a7fa9d1e2fdff9.
