-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,15 +62,7 @@ | |
import static com.xebialabs.overthere.ConnectionOptions.PASSWORD; | ||
import static com.xebialabs.overthere.ConnectionOptions.PORT; | ||
import static com.xebialabs.overthere.ConnectionOptions.USERNAME; | ||
import static com.xebialabs.overthere.ssh.SshConnectionBuilder.ALLOCATE_DEFAULT_PTY; | ||
import static com.xebialabs.overthere.ssh.SshConnectionBuilder.ALLOCATE_DEFAULT_PTY_DEFAULT; | ||
import static com.xebialabs.overthere.ssh.SshConnectionBuilder.ALLOCATE_PTY; | ||
import static com.xebialabs.overthere.ssh.SshConnectionBuilder.CONNECTION_TYPE; | ||
import static com.xebialabs.overthere.ssh.SshConnectionBuilder.INTERACTIVE_KEYBOARD_AUTH_PROMPT_REGEX; | ||
import static com.xebialabs.overthere.ssh.SshConnectionBuilder.INTERACTIVE_KEYBOARD_AUTH_PROMPT_REGEX_DEFAULT; | ||
import static com.xebialabs.overthere.ssh.SshConnectionBuilder.PASSPHRASE; | ||
import static com.xebialabs.overthere.ssh.SshConnectionBuilder.PRIVATE_KEY_FILE; | ||
import static com.xebialabs.overthere.ssh.SshConnectionBuilder.SSH_PORT_DEFAULT; | ||
import static com.xebialabs.overthere.ssh.SshConnectionBuilder.*; | ||
This comment has been minimized.
Sorry, something went wrong. |
||
import static java.net.InetSocketAddress.createUnresolved; | ||
|
||
/** | ||
|
@@ -100,6 +92,8 @@ abstract class SshConnection extends BaseOverthereConnection { | |
|
||
protected final boolean allocateDefaultPty; | ||
|
||
protected final boolean openShellBeforeExecute; | ||
|
||
protected String allocatePty; | ||
|
||
protected SSHClient sshClient; | ||
|
@@ -129,6 +123,7 @@ public SshConnection(final String protocol, final ConnectionOptions options, fin | |
logger.warn("The " + ALLOCATE_DEFAULT_PTY + " connection option has been deprecated in favour of the " + ALLOCATE_PTY + " option. See https://github.com/xebialabs/overthere#ssh_allocatePty"); | ||
} | ||
this.allocatePty = options.getOptional(ALLOCATE_PTY); | ||
this.openShellBeforeExecute = options.getBoolean(OPEN_SHELL_BEFORE_EXECUTE, OPEN_SHELL_BEFORE_EXECUTE_DEFAULT); | ||
} | ||
|
||
protected void connect() { | ||
|
@@ -238,6 +233,12 @@ public OverthereProcess startProcess(final CmdLine commandLine) { | |
|
||
CmdLine cmd = processCommandLine(commandLine); | ||
try { | ||
if (openShellBeforeExecute) { | ||
logger.debug("Creating a temporary shell to allow for deferred home dir creation."); | ||
Session.Shell shell = getSshClient().startSession().startShell(); | ||
This comment has been minimized.
Sorry, something went wrong.
vpartington
Contributor
|
||
shell.close(); | ||
} | ||
|
||
Session session = getSshClient().startSession(); | ||
if (allocatePty != null && !allocatePty.isEmpty()) { | ||
if (allocateDefaultPty) { | ||
|
1 comment
on commit fcdb1dc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice implementation. Let's see how it works without the only-do-it-once check first.
Grmbl. Didn't we synchronize our formatting and organize imports conventions?