// Path: wava-client/src/main/java/org/brutusin/wava/env/WavaTemp.java
// public final class WavaTemp {
// 
//     private static final WavaTemp INSTANCE = new WavaTemp();
// 
//     private final File temp;
// 
//     public static WavaTemp getInstance() {
//         return INSTANCE;
//     }
// 
//     private WavaTemp() {
//         this.temp = Config.getInstance().getTempFolder();
//     }
// 
//     public File getTemp() {
//         return temp;
//     }
// }
// 
// Path: wava-client/src/main/java/org/brutusin/wava/Utils.java
// public class Utils {
// 
//     public final static DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
//     private final static File LOCK_FILE = new File(WavaTemp.getInstance().getTemp(), ".lock");
// 
//     public static List<String> parseEventLine(String line) {
//         List<String> ret = new ArrayList<>();
//         int start = 0;
//         boolean inString = false;
//         for (int i = 0; i < line.length(); i++) {
//             if (line.charAt(i) == '"' && (i == 0 || line.charAt(i - 1) != '\\')) {
//                 inString = !inString;
//             }
//             if (!inString && line.charAt(i) == ':') {
//                 ret.add(line.substring(start, i));
//                 start = i + 1;
//             }
//         }
//         if (start < line.length()) {
//             ret.add(line.substring(start));
//         }
//         return ret;
//     }
// 
//     public static FileLock tryWavaLock() throws IOException {
//         return tryLock(LOCK_FILE);
//     }
// 
//     private static FileLock tryLock(File f) throws IOException {
//         synchronized (f) {
//             if (!f.exists()) {
//                 Miscellaneous.createFile(f.getAbsolutePath());
//             }
//             RandomAccessFile raf = new RandomAccessFile(f, "rws");
//             return raf.getChannel().tryLock();
//         }
//     }
// 
//     public static boolean isCoreRunning() throws IOException {
//         synchronized (LOCK_FILE) {
//             FileLock lock = tryWavaLock();
//             if (lock != null) {
//                 lock.release();
//             }
//             return lock == null;
//         }
//     }
// 
//     public static int getJVMPid() {
//         try {
//             String[] cmd = {"/bin/bash", "-c", "echo $PPID"};
//             return Integer.valueOf(ProcessUtils.executeProcess(cmd));
//         } catch (Exception ex) {
//             throw new RuntimeException(ex);
//         }
//     }
// }
// 
// Path: wava-client/src/main/java/org/brutusin/wava/input/Input.java
// public class Input {
// 
//     private final int clientPid = Utils.getJVMPid();
// 
//     public int getClientPid() {
//         return clientPid;
//     }
// }


import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.nio.file.Files;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.brutusin.commons.Bean;
import org.brutusin.commons.utils.Miscellaneous;
import org.brutusin.commons.utils.ProcessUtils;
import org.brutusin.json.spi.JsonCodec;
import org.brutusin.wava.env.WavaTemp;
import org.brutusin.wava.Utils;
import org.brutusin.wava.input.Input;

                    BufferedReader br = new BufferedReader(new InputStreamReader(is));
                    String line;
                    while ((line = br.readLine()) != null) {
                        if (stderrListener != null) {
                            stderrListener.onNewLine(line);
                        }
                    }
                } catch (Throwable th) {
                    LOGGER.log(Level.SEVERE, th.getMessage(), th);
                } finally {
                    if (is != null) {
                        try {
                            is.close();
                        } catch (IOException ex) {
                            LOGGER.log(Level.SEVERE, null, ex);
                        }
                    }
                }
            }
        };
        errThread.start();

        Thread timeoutThread = new Thread() {
            @Override
            public void run() {
                try {
                    Thread.sleep(10 * 1000); // If after this time the pipes have not been open for reading (nobody is using the other side) discard all
                    synchronized (timeoutBean) {
                        if (timeoutBean.getValue() == null) {
                            timeoutBean.setValue(true);

// Path: wava-client/src/main/java/org/brutusin/wava/env/WavaTemp.java
// public final class WavaTemp {
// 
//     private static final WavaTemp INSTANCE = new WavaTemp();
// 
//     private final File temp;
// 
//     public static WavaTemp getInstance() {
//         return INSTANCE;
//     }
// 
//     private WavaTemp() {
//         this.temp = Config.getInstance().getTempFolder();
//     }
// 
//     public File getTemp() {
//         return temp;
//     }
// }
// 
// Path: wava-client/src/main/java/org/brutusin/wava/Utils.java
// public class Utils {
// 
//     public final static DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
//     private final static File LOCK_FILE = new File(WavaTemp.getInstance().getTemp(), ".lock");
// 
//     public static List<String> parseEventLine(String line) {
//         List<String> ret = new ArrayList<>();
//         int start = 0;
//         boolean inString = false;
//         for (int i = 0; i < line.length(); i++) {
//             if (line.charAt(i) == '"' && (i == 0 || line.charAt(i - 1) != '\\')) {
//                 inString = !inString;
//             }
//             if (!inString && line.charAt(i) == ':') {
//                 ret.add(line.substring(start, i));
//                 start = i + 1;
//             }
//         }
//         if (start < line.length()) {
//             ret.add(line.substring(start));
//         }
//         return ret;
//     }
// 
//     public static FileLock tryWavaLock() throws IOException {
//         return tryLock(LOCK_FILE);
//     }
// 
//     private static FileLock tryLock(File f) throws IOException {
//         synchronized (f) {
//             if (!f.exists()) {
//                 Miscellaneous.createFile(f.getAbsolutePath());
//             }
//             RandomAccessFile raf = new RandomAccessFile(f, "rws");
//             return raf.getChannel().tryLock();
//         }
//     }
// 
//     public static boolean isCoreRunning() throws IOException {
//         synchronized (LOCK_FILE) {
//             FileLock lock = tryWavaLock();
//             if (lock != null) {
//                 lock.release();
//             }
//             return lock == null;
//         }
//     }
// 
//     public static int getJVMPid() {
//         try {
//             String[] cmd = {"/bin/bash", "-c", "echo $PPID"};
//             return Integer.valueOf(ProcessUtils.executeProcess(cmd));
//         } catch (Exception ex) {
//             throw new RuntimeException(ex);
//         }
//     }
// }
// 
// Path: wava-client/src/main/java/org/brutusin/wava/input/Input.java
// public class Input {
// 
//     private final int clientPid = Utils.getJVMPid();
// 
//     public int getClientPid() {
//         return clientPid;
//     }
// }


// Path: wava-client/src/main/java/org/brutusin/wava/io/RequestExecutor.java
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.nio.file.Files;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.brutusin.commons.Bean;
import org.brutusin.commons.utils.Miscellaneous;
import org.brutusin.commons.utils.ProcessUtils;
import org.brutusin.json.spi.JsonCodec;
import org.brutusin.wava.env.WavaTemp;
import org.brutusin.wava.Utils;
import org.brutusin.wava.input.Input;

                    BufferedReader br = new BufferedReader(new InputStreamReader(is));
                    String line;
                    while ((line = br.readLine()) != null) {
                        if (stderrListener != null) {
                            stderrListener.onNewLine(line);
                        }
                    }
                } catch (Throwable th) {
                    LOGGER.log(Level.SEVERE, th.getMessage(), th);
                } finally {
                    if (is != null) {
                        try {
                            is.close();
                        } catch (IOException ex) {
                            LOGGER.log(Level.SEVERE, null, ex);
                        }
                    }
                }
            }
        };
        errThread.start();

        Thread timeoutThread = new Thread() {
            @Override
            public void run() {
                try {
                    Thread.sleep(10 * 1000); // If after this time the pipes have not been open for reading (nobody is using the other side) discard all
                    synchronized (timeoutBean) {
                        if (timeoutBean.getValue() == null) {
                            timeoutBean.setValue(true);

                            try {
