// Path: srcdeps-core/src/main/java/org/srcdeps/core/BuildException.java
// public class BuildException extends Exception {
//     private static final long serialVersionUID = 1520625837859688798L;
// 
//     public BuildException(String message) {
//         super(message);
//     }
// 
//     public BuildException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public BuildException(Throwable cause) {
//         super(cause);
//     }
// 
// }


import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.srcdeps.core.BuildException;
/**
 * Copyright 2015-2019 Maven Source Dependencies
 * Plugin contributors as indicated by the @author tags.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.srcdeps.core.shell;



/**
 * A utility for executing {@link ShellCommand}s.
 *
 * @author <a href="https://github.com/ppalaga">Peter Palaga</a>
 */
public class Shell {

    /**
     * A simple wrapper over {@link Process} that manages its destroying and offers Java 8-like
     * {@link #waitFor(long, TimeUnit, String[])} with timeout.
     */
    public static class CommandProcess implements Closeable {

        private final Process process;
// Path: srcdeps-core/src/main/java/org/srcdeps/core/BuildException.java
// public class BuildException extends Exception {
//     private static final long serialVersionUID = 1520625837859688798L;
// 
//     public BuildException(String message) {
//         super(message);
//     }
// 
//     public BuildException(String message, Throwable cause) {
//         super(message, cause);
//     }
// 
//     public BuildException(Throwable cause) {
//         super(cause);
//     }
// 
// }


// Path: srcdeps-core/src/main/java/org/srcdeps/core/shell/Shell.java
import java.io.BufferedReader;
import java.io.Closeable;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.Map;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.srcdeps.core.BuildException;

/**
 * Copyright 2015-2019 Maven Source Dependencies
 * Plugin contributors as indicated by the @author tags.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.srcdeps.core.shell;



/**
 * A utility for executing {@link ShellCommand}s.
 *
 * @author <a href="https://github.com/ppalaga">Peter Palaga</a>
 */
public class Shell {

    /**
     * A simple wrapper over {@link Process} that manages its destroying and offers Java 8-like
     * {@link #waitFor(long, TimeUnit, String[])} with timeout.
     */
    public static class CommandProcess implements Closeable {

        private final Process process;
        private final Thread shutDownHook;