Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Marco Bubke
flatpak-qt-creator
Commits
15ab6949
Commit
15ab6949
authored
Aug 19, 2010
by
Christian Kandeler
Browse files
SSH: Handle exit-status and exit-signal in SFTP channels as well.
parent
0a7e4c43
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/plugins/coreplugin/ssh/sftpchannel.cpp
View file @
15ab6949
...
...
@@ -31,6 +31,7 @@
#include "sftpchannel_p.h"
#include "sshexception_p.h"
#include "sshincomingpacket_p.h"
#include "sshsendfacility_p.h"
#include <QtCore/QDir>
...
...
@@ -248,6 +249,22 @@ void SftpChannelPrivate::handleChannelExtendedDataInternal(quint32 type,
data
.
data
(),
type
);
}
void
SftpChannelPrivate
::
handleExitStatus
(
const
SshChannelExitStatus
&
exitStatus
)
{
const
char
*
const
message
=
"Remote SFTP service exited with exit code %d"
;
#ifdef CREATOR_SSH_DEBUG
qDebug
(
message
,
exitStatus
.
exitStatus
);
#else
if
(
exitStatus
.
exitStatus
!=
0
)
qWarning
(
message
,
exitStatus
.
exitStatus
);
#endif
}
void
SftpChannelPrivate
::
handleExitSignal
(
const
SshChannelExitSignal
&
signal
)
{
qWarning
(
"Remote SFTP service killed; signal was %s"
,
signal
.
signal
.
data
());
}
void
SftpChannelPrivate
::
handleCurrentPacket
()
{
#ifdef CREATOR_SSH_DEBUG
...
...
src/plugins/coreplugin/ssh/sftpchannel_p.h
View file @
15ab6949
...
...
@@ -75,6 +75,8 @@ private:
virtual
void
handleChannelDataInternal
(
const
QByteArray
&
data
);
virtual
void
handleChannelExtendedDataInternal
(
quint32
type
,
const
QByteArray
&
data
);
virtual
void
handleExitStatus
(
const
SshChannelExitStatus
&
exitStatus
);
virtual
void
handleExitSignal
(
const
SshChannelExitSignal
&
signal
);
void
handleCurrentPacket
();
void
handleServerVersion
();
...
...
src/plugins/coreplugin/ssh/sshchannel.cpp
View file @
15ab6949
...
...
@@ -202,8 +202,14 @@ void AbstractSshChannel::handleChannelExtendedData(quint32 type, const QByteArra
void
AbstractSshChannel
::
handleChannelRequest
(
const
SshIncomingPacket
&
packet
)
{
qWarning
(
"Ignoring unknown request type '%s'"
,
packet
.
extractChannelRequestType
().
data
());
checkChannelActive
();
const
QByteArray
&
requestType
=
packet
.
extractChannelRequestType
();
if
(
requestType
==
SshIncomingPacket
::
ExitStatusType
)
handleExitStatus
(
packet
.
extractChannelExitStatus
());
else
if
(
requestType
==
SshIncomingPacket
::
ExitSignalType
)
handleExitSignal
(
packet
.
extractChannelExitSignal
());
else
qWarning
(
"Ignoring unknown request type '%s'"
,
requestType
.
data
());
}
int
AbstractSshChannel
::
handleChannelOrExtendedChannelData
(
const
QByteArray
&
data
)
...
...
src/plugins/coreplugin/ssh/sshchannel_p.h
View file @
15ab6949
...
...
@@ -39,6 +39,8 @@ QT_FORWARD_DECLARE_CLASS(QTimer);
namespace
Core
{
namespace
Internal
{
class
SshChannelExitSignal
;
class
SshChannelExitStatus
;
class
SshIncomingPacket
;
class
SshSendFacility
;
...
...
@@ -61,7 +63,6 @@ public:
virtual
void
handleChannelSuccess
()
=
0
;
virtual
void
handleChannelFailure
()
=
0
;
virtual
void
handleChannelRequest
(
const
SshIncomingPacket
&
packet
);
virtual
void
closeHook
()
=
0
;
...
...
@@ -73,6 +74,7 @@ public:
void
handleChannelClose
();
void
handleChannelData
(
const
QByteArray
&
data
);
void
handleChannelExtendedData
(
quint32
type
,
const
QByteArray
&
data
);
void
handleChannelRequest
(
const
SshIncomingPacket
&
packet
);
void
requestSessionStart
();
void
sendData
(
const
QByteArray
&
data
);
...
...
@@ -100,6 +102,8 @@ private:
virtual
void
handleChannelDataInternal
(
const
QByteArray
&
data
)
=
0
;
virtual
void
handleChannelExtendedDataInternal
(
quint32
type
,
const
QByteArray
&
data
)
=
0
;
virtual
void
handleExitStatus
(
const
SshChannelExitStatus
&
exitStatus
)
=
0
;
virtual
void
handleExitSignal
(
const
SshChannelExitSignal
&
signal
)
=
0
;
void
setState
(
ChannelState
newState
);
void
flushSendBuffer
();
...
...
src/plugins/coreplugin/ssh/sshremoteprocess.cpp
View file @
15ab6949
...
...
@@ -210,28 +210,23 @@ void SshRemoteProcessPrivate::handleChannelExtendedDataInternal(quint32 type,
emit
errorOutputAvailable
(
data
);
}
void
SshRemoteProcessPrivate
::
handle
ChannelRequest
(
const
SshIncomingPacket
&
packet
)
void
SshRemoteProcessPrivate
::
handle
ExitStatus
(
const
SshChannelExitStatus
&
exitStatus
)
{
checkChannelActive
();
const
QByteArray
&
requestType
=
packet
.
extractChannelRequestType
();
if
(
requestType
==
SshIncomingPacket
::
ExitStatusType
)
{
const
SshChannelExitStatus
status
=
packet
.
extractChannelExitStatus
();
#ifdef CREATOR_SSH_DEBUG
qDebug
(
"Process exiting with exit code %d"
,
s
tatus
.
exitStatus
);
qDebug
(
"Process exiting with exit code %d"
,
exitS
tatus
.
exitStatus
);
#endif
m_exitCode
=
status
.
exitStatus
;
m_procState
=
Exited
;
}
else
if
(
requestType
==
SshIncomingPacket
::
ExitSignalType
)
{
const
SshChannelExitSignal
&
signal
=
packet
.
extractChannelExitSignal
();
m_exitCode
=
exitStatus
.
exitStatus
;
m_procState
=
Exited
;
}
void
SshRemoteProcessPrivate
::
handleExitSignal
(
const
SshChannelExitSignal
&
signal
)
{
#ifdef CREATOR_SSH_DEBUG
qDebug
(
"Exit due to signal %s"
,
signal
.
signal
.
data
());
qDebug
(
"Exit due to signal %s"
,
signal
.
signal
.
data
());
#endif
setError
(
signal
.
error
);
m_signal
=
signal
.
signal
;
m_procState
=
Exited
;
}
else
{
qWarning
(
"Ignoring unknown request type '%s'"
,
requestType
.
data
());
}
setError
(
signal
.
error
);
m_signal
=
signal
.
signal
;
m_procState
=
Exited
;
}
}
// namespace Internal
...
...
src/plugins/coreplugin/ssh/sshremoteprocess_p.h
View file @
15ab6949
...
...
@@ -70,7 +70,8 @@ private:
virtual
void
handleChannelDataInternal
(
const
QByteArray
&
data
);
virtual
void
handleChannelExtendedDataInternal
(
quint32
type
,
const
QByteArray
&
data
);
virtual
void
handleChannelRequest
(
const
SshIncomingPacket
&
packet
);
virtual
void
handleExitStatus
(
const
SshChannelExitStatus
&
exitStatus
);
virtual
void
handleExitSignal
(
const
SshChannelExitSignal
&
signal
);
void
setProcState
(
ProcessState
newState
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment