package com.sourcefellows.patterns.singleton;

import java.io.BufferedReader;
import java.io.IOException;

public class Main {

    public static void main(String[] args) throws IOException {

        Runtime r = Runtime.getRuntime();
        r.addShutdownHook(new Thread(() -> {
            System.out.println("Bye bye");
        }));

        // Garbage Collector aufrufen
        r.gc();
        String[] cmd = new String[]{"sh", "-c", "echo Hello"};
        String[] params = new String[]{};
        Process exec = r.exec(cmd, params);

        BufferedReader br = exec.inputReader();
        System.out.println(br.readLine());

        // Process beenden
        r.exit(0);

    }

}

