1 /*
2 * Copyright (C) 2020, Thomas Wolf <thomas.wolf@paranor.ch> and others
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Distribution License v. 1.0 which is available at
6 * https://www.eclipse.org/org/documents/edl-v10.php.
7 *
8 * SPDX-License-Identifier: BSD-3-Clause
9 */
10
11 package org.eclipse.jgit.transport;
12
13 import java.io.IOException;
14 import java.util.Map;
15
16 /**
17 * A {@link RemoteSession} that supports passing environment variables to
18 * commands.
19 *
20 * @since 5.11
21 */
22 public interface RemoteSession2 extends RemoteSession {
23
24 /**
25 * Creates a new remote {@link Process} to execute the given command. The
26 * returned process's streams exist and are connected, and execution of the
27 * process is already started.
28 *
29 * @param commandName
30 * command to execute
31 * @param environment
32 * environment variables to pass on
33 * @param timeout
34 * timeout value, in seconds, for creating the remote process
35 * @return a new remote process, already started
36 * @throws java.io.IOException
37 * may be thrown in several cases. For example, on problems
38 * opening input or output streams or on problems connecting or
39 * communicating with the remote host. For the latter two cases,
40 * a TransportException may be thrown (a subclass of
41 * java.io.IOException).
42 */
43 Process exec(String commandName, Map<String, String> environment,
44 int timeout) throws IOException;
45 }