mirror of
https://github.com/alibaba/arthas.git
synced 2024-04-21 10:21:39 +00:00
check telnet port before connect telnet server
This commit is contained in:
@@ -984,9 +984,10 @@ main()
|
||||
|
||||
echo "Attach success."
|
||||
|
||||
if [ ${ATTACH_ONLY} = false ]; then
|
||||
if [ ${ATTACH_ONLY} = false ] and [ $TELNET_PORT > 0 ]; then
|
||||
active_console "${ARTHAS_HOME}"
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -473,8 +473,10 @@ public class Bootstrap {
|
||||
AnsiLog.info("The target process already listen port {}, skip attach.", bootstrap.getTelnetPort());
|
||||
} else {
|
||||
//double check telnet port and pid before attach
|
||||
telnetPortPid = findProcessByTelnetClient(arthasHomeDir.getAbsolutePath(), bootstrap.getTelnetPort());
|
||||
checkTelnetPortPid(bootstrap, telnetPortPid, pid);
|
||||
if (bootstrap.getTelnetPort() > 0) {
|
||||
telnetPortPid = findProcessByTelnetClient(arthasHomeDir.getAbsolutePath(), bootstrap.getTelnetPort());
|
||||
checkTelnetPortPid(bootstrap, telnetPortPid, pid);
|
||||
}
|
||||
|
||||
// start arthas-core.jar
|
||||
List<String> attachArgs = new ArrayList<String>();
|
||||
@@ -521,7 +523,7 @@ public class Bootstrap {
|
||||
AnsiLog.info("Attach process {} success.", pid);
|
||||
}
|
||||
|
||||
if (bootstrap.isAttachOnly()) {
|
||||
if (bootstrap.isAttachOnly() || bootstrap.getTelnetPort() <= 0) {
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user