| 1 | /* |
| 2 | * procfork |
| 3 | * |
| 4 | * Copyright (C) 2019, Dawid Weiss. |
| 5 | * All rights reserved. |
| 6 | */ |
| 7 | package com.carrotsearch.procfork; |
| 8 | |
| 9 | import java.io.IOException; |
| 10 | import java.nio.file.Path; |
| 11 | |
| 12 | /** |
| 13 | * An abstraction layer over the functionality required to fork a subprocess and collect its output. |
| 14 | */ |
| 15 | public interface Launcher { |
| 16 | Launcher executable(Path executable); |
| 17 | |
| 18 | Launcher cwd(Path cwd); |
| 19 | |
| 20 | Launcher viaShellLauncher(); |
| 21 | |
| 22 | Launcher arg(String value); |
| 23 | |
| 24 | Launcher args(String... values); |
| 25 | |
| 26 | Launcher envvar(String key, String value); |
| 27 | |
| 28 | Launcher input(Path input); |
| 29 | |
| 30 | /** Execute and return the resulting process handle/ wrapper. */ |
| 31 | ForkedProcess execute() throws IOException; |
| 32 | } |