Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
cfb232eb
Commit
cfb232eb
authored
May 11, 2011
by
Oswald Buddenhagen
Browse files
ConsoleProcess: undo pointless processError() => processMessage(bool error) change
parent
322a8481
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/libs/utils/consoleprocess.h
View file @
cfb232eb
...
...
@@ -95,7 +95,7 @@ public:
#endif
signals:
void
process
Message
(
const
QString
&
message
,
bool
isE
rror
);
void
process
Error
(
const
QString
&
e
rror
);
// These reflect the state of the actual client process
void
processStarted
();
void
processStopped
();
...
...
src/libs/utils/consoleprocess_unix.cpp
View file @
cfb232eb
...
...
@@ -83,13 +83,13 @@ bool ConsoleProcess::start(const QString &program, const QString &args)
pcmd
=
program
;
}
else
{
if
(
perr
!=
QtcProcess
::
FoundMeta
)
{
emit
process
Message
(
tr
(
"Quoting error in command."
)
,
true
);
emit
process
Error
(
tr
(
"Quoting error in command."
));
return
false
;
}
if
(
d
->
m_mode
==
Debug
)
{
// FIXME: QTCREATORBUG-2809
emit
process
Message
(
tr
(
"Debugging complex shell commands in a terminal"
" is currently not supported."
)
,
true
);
emit
process
Error
(
tr
(
"Debugging complex shell commands in a terminal"
" is currently not supported."
));
return
false
;
}
pcmd
=
QLatin1String
(
"/bin/sh"
);
...
...
@@ -100,15 +100,15 @@ bool ConsoleProcess::start(const QString &program, const QString &args)
QStringList
xtermArgs
=
QtcProcess
::
prepareArgs
(
terminalEmulator
(
d
->
m_settings
),
&
qerr
,
&
d
->
m_environment
,
&
d
->
m_workingDir
);
if
(
qerr
!=
QtcProcess
::
SplitOk
)
{
emit
process
Message
(
qerr
==
QtcProcess
::
BadQuoting
?
tr
(
"Quoting error in terminal command."
)
:
tr
(
"Terminal command may not be a shell command."
)
,
true
);
emit
process
Error
(
qerr
==
QtcProcess
::
BadQuoting
?
tr
(
"Quoting error in terminal command."
)
:
tr
(
"Terminal command may not be a shell command."
));
return
false
;
}
const
QString
err
=
stubServerListen
();
if
(
!
err
.
isEmpty
())
{
emit
process
Message
(
msgCommChannelFailed
(
err
)
,
true
);
emit
process
Error
(
msgCommChannelFailed
(
err
));
return
false
;
}
...
...
@@ -117,7 +117,7 @@ bool ConsoleProcess::start(const QString &program, const QString &args)
d
->
m_tempFile
=
new
QTemporaryFile
();
if
(
!
d
->
m_tempFile
->
open
())
{
stubServerShutdown
();
emit
process
Message
(
msgCannotCreateTempFile
(
d
->
m_tempFile
->
errorString
())
,
true
);
emit
process
Error
(
msgCannotCreateTempFile
(
d
->
m_tempFile
->
errorString
()));
delete
d
->
m_tempFile
;
d
->
m_tempFile
=
0
;
return
false
;
...
...
@@ -129,7 +129,7 @@ bool ConsoleProcess::start(const QString &program, const QString &args)
}
if
(
d
->
m_tempFile
->
write
(
contents
)
!=
contents
.
size
()
||
!
d
->
m_tempFile
->
flush
())
{
stubServerShutdown
();
emit
process
Message
(
msgCannotWriteTempFile
()
,
true
);
emit
process
Error
(
msgCannotWriteTempFile
());
delete
d
->
m_tempFile
;
d
->
m_tempFile
=
0
;
return
false
;
...
...
@@ -153,7 +153,7 @@ bool ConsoleProcess::start(const QString &program, const QString &args)
d
->
m_process
.
start
(
xterm
,
xtermArgs
);
if
(
!
d
->
m_process
.
waitForStarted
())
{
stubServerShutdown
();
emit
process
Message
(
tr
(
"Cannot start the terminal emulator '%1'."
).
arg
(
xterm
)
,
true
);
emit
process
Error
(
tr
(
"Cannot start the terminal emulator '%1'."
).
arg
(
xterm
));
delete
d
->
m_tempFile
;
d
->
m_tempFile
=
0
;
return
false
;
...
...
@@ -234,9 +234,9 @@ void ConsoleProcess::readStubOutput()
QByteArray
out
=
d
->
m_stubSocket
->
readLine
();
out
.
chop
(
1
);
// \n
if
(
out
.
startsWith
(
"err:chdir "
))
{
emit
process
Message
(
msgCannotChangeToWorkDir
(
workingDirectory
(),
errorMsg
(
out
.
mid
(
10
).
toInt
()))
,
true
);
emit
process
Error
(
msgCannotChangeToWorkDir
(
workingDirectory
(),
errorMsg
(
out
.
mid
(
10
).
toInt
())));
}
else
if
(
out
.
startsWith
(
"err:exec "
))
{
emit
process
Message
(
msgCannotExecute
(
d
->
m_executable
,
errorMsg
(
out
.
mid
(
9
).
toInt
()))
,
true
);
emit
process
Error
(
msgCannotExecute
(
d
->
m_executable
,
errorMsg
(
out
.
mid
(
9
).
toInt
())));
}
else
if
(
out
.
startsWith
(
"pid "
))
{
// Will not need it any more
delete
d
->
m_tempFile
;
...
...
@@ -255,7 +255,7 @@ void ConsoleProcess::readStubOutput()
d
->
m_appPid
=
0
;
emit
processStopped
();
}
else
{
emit
process
Message
(
msgUnexpectedOutput
(
out
)
,
true
);
emit
process
Error
(
msgUnexpectedOutput
(
out
));
d
->
m_process
.
terminate
();
break
;
}
...
...
src/libs/utils/consoleprocess_win.cpp
View file @
cfb232eb
...
...
@@ -82,7 +82,7 @@ bool ConsoleProcess::start(const QString &program, const QString &args)
const
QString
err
=
stubServerListen
();
if
(
!
err
.
isEmpty
())
{
emit
process
Message
(
msgCommChannelFailed
(
err
)
,
true
);
emit
process
Error
(
msgCommChannelFailed
(
err
));
return
false
;
}
...
...
@@ -91,7 +91,7 @@ bool ConsoleProcess::start(const QString &program, const QString &args)
d
->
m_tempFile
=
new
QTemporaryFile
();
if
(
!
d
->
m_tempFile
->
open
())
{
stubServerShutdown
();
emit
process
Message
(
msgCannotCreateTempFile
(
d
->
m_tempFile
->
errorString
())
,
true
);
emit
process
Error
(
msgCannotCreateTempFile
(
d
->
m_tempFile
->
errorString
()));
delete
d
->
m_tempFile
;
d
->
m_tempFile
=
0
;
return
false
;
...
...
@@ -106,7 +106,7 @@ bool ConsoleProcess::start(const QString &program, const QString &args)
out
.
flush
();
if
(
out
.
status
()
!=
QTextStream
::
Ok
)
{
stubServerShutdown
();
emit
process
Message
(
msgCannotWriteTempFile
()
,
true
);
emit
process
Error
(
msgCannotWriteTempFile
());
delete
d
->
m_tempFile
;
d
->
m_tempFile
=
0
;
return
false
;
...
...
@@ -147,7 +147,7 @@ bool ConsoleProcess::start(const QString &program, const QString &args)
delete
d
->
m_tempFile
;
d
->
m_tempFile
=
0
;
stubServerShutdown
();
emit
process
Message
(
tr
(
"The process '%1' could not be started: %2"
).
arg
(
cmdLine
,
winErrorMessage
(
GetLastError
()))
,
true
);
emit
process
Error
(
tr
(
"The process '%1' could not be started: %2"
).
arg
(
cmdLine
,
winErrorMessage
(
GetLastError
())));
return
false
;
}
...
...
@@ -204,9 +204,9 @@ void ConsoleProcess::readStubOutput()
QByteArray
out
=
d
->
m_stubSocket
->
readLine
();
out
.
chop
(
2
);
// \r\n
if
(
out
.
startsWith
(
"err:chdir "
))
{
emit
process
Message
(
msgCannotChangeToWorkDir
(
workingDirectory
(),
winErrorMessage
(
out
.
mid
(
10
).
toInt
()))
,
true
);
emit
process
Error
(
msgCannotChangeToWorkDir
(
workingDirectory
(),
winErrorMessage
(
out
.
mid
(
10
).
toInt
())));
}
else
if
(
out
.
startsWith
(
"err:exec "
))
{
emit
process
Message
(
msgCannotExecute
(
d
->
m_executable
,
winErrorMessage
(
out
.
mid
(
9
).
toInt
()))
,
true
);
emit
process
Error
(
msgCannotExecute
(
d
->
m_executable
,
winErrorMessage
(
out
.
mid
(
9
).
toInt
())));
}
else
if
(
out
.
startsWith
(
"thread "
))
{
// Windows only
d
->
m_appMainThreadId
=
out
.
mid
(
7
).
toLongLong
();
}
else
if
(
out
.
startsWith
(
"pid "
))
{
...
...
@@ -219,8 +219,8 @@ void ConsoleProcess::readStubOutput()
SYNCHRONIZE
|
PROCESS_QUERY_INFORMATION
|
PROCESS_TERMINATE
,
FALSE
,
d
->
m_appPid
);
if
(
d
->
m_hInferior
==
NULL
)
{
emit
process
Message
(
tr
(
"Cannot obtain a handle to the inferior: %1"
)
.
arg
(
winErrorMessage
(
GetLastError
()))
,
true
);
emit
process
Error
(
tr
(
"Cannot obtain a handle to the inferior: %1"
)
.
arg
(
winErrorMessage
(
GetLastError
())));
// Uhm, and now what?
continue
;
}
...
...
@@ -228,7 +228,7 @@ void ConsoleProcess::readStubOutput()
connect
(
d
->
inferiorFinishedNotifier
,
SIGNAL
(
activated
(
HANDLE
)),
SLOT
(
inferiorExited
()));
emit
processStarted
();
}
else
{
emit
process
Message
(
msgUnexpectedOutput
(
out
)
,
true
);
emit
process
Error
(
msgUnexpectedOutput
(
out
));
TerminateProcess
(
d
->
m_pid
->
hProcess
,
(
unsigned
)
-
1
);
break
;
}
...
...
@@ -249,8 +249,8 @@ void ConsoleProcess::inferiorExited()
DWORD
chldStatus
;
if
(
!
GetExitCodeProcess
(
d
->
m_hInferior
,
&
chldStatus
))
emit
process
Message
(
tr
(
"Cannot obtain exit status from inferior: %1"
)
.
arg
(
winErrorMessage
(
GetLastError
()))
,
true
);
emit
process
Error
(
tr
(
"Cannot obtain exit status from inferior: %1"
)
.
arg
(
winErrorMessage
(
GetLastError
())));
cleanupInferior
();
d
->
m_appStatus
=
QProcess
::
NormalExit
;
d
->
m_appCode
=
chldStatus
;
...
...
src/plugins/debugger/cdb/cdbengine.cpp
View file @
cfb232eb
...
...
@@ -614,8 +614,8 @@ bool CdbEngine::startConsole(const DebuggerStartParameters &sp, QString *errorMe
qDebug
(
"startConsole %s"
,
qPrintable
(
sp
.
executable
));
m_consoleStub
.
reset
(
new
Utils
::
ConsoleProcess
);
m_consoleStub
->
setMode
(
Utils
::
ConsoleProcess
::
Suspend
);
connect
(
m_consoleStub
.
data
(),
SIGNAL
(
process
Message
(
QString
,
bool
)),
SLOT
(
consoleStub
Message
(
QString
,
bool
)));
connect
(
m_consoleStub
.
data
(),
SIGNAL
(
process
Error
(
QString
)),
SLOT
(
consoleStub
Error
(
QString
)));
connect
(
m_consoleStub
.
data
(),
SIGNAL
(
processStarted
()),
SLOT
(
consoleStubProcessStarted
()));
connect
(
m_consoleStub
.
data
(),
SIGNAL
(
wrapperStopped
()),
...
...
@@ -630,22 +630,18 @@ bool CdbEngine::startConsole(const DebuggerStartParameters &sp, QString *errorMe
return
true
;
}
void
CdbEngine
::
consoleStub
Message
(
const
QString
&
msg
,
bool
isError
)
void
CdbEngine
::
consoleStub
Error
(
const
QString
&
msg
)
{
if
(
debug
)
qDebug
(
"consoleStubProcessMessage() in %s error=%d %s"
,
stateName
(
state
()),
isError
,
qPrintable
(
msg
));
if
(
isError
)
{
if
(
state
()
==
EngineSetupRequested
)
{
STATE_DEBUG
(
state
(),
Q_FUNC_INFO
,
__LINE__
,
"notifyEngineSetupFailed"
)
notifyEngineSetupFailed
();
}
else
{
STATE_DEBUG
(
state
(),
Q_FUNC_INFO
,
__LINE__
,
"notifyEngineIll"
)
notifyEngineIll
();
}
nonModalMessageBox
(
QMessageBox
::
Critical
,
tr
(
"Debugger Error"
),
msg
);
qDebug
(
"consoleStubProcessMessage() in %s %s"
,
stateName
(
state
()),
qPrintable
(
msg
));
if
(
state
()
==
EngineSetupRequested
)
{
STATE_DEBUG
(
state
(),
Q_FUNC_INFO
,
__LINE__
,
"notifyEngineSetupFailed"
)
notifyEngineSetupFailed
();
}
else
{
showMessage
(
msg
,
AppOutput
);
STATE_DEBUG
(
state
(),
Q_FUNC_INFO
,
__LINE__
,
"notifyEngineIll"
)
notifyEngineIll
();
}
nonModalMessageBox
(
QMessageBox
::
Critical
,
tr
(
"Debugger Error"
),
msg
);
}
void
CdbEngine
::
consoleStubProcessStarted
()
...
...
src/plugins/debugger/cdb/cdbengine.h
View file @
cfb232eb
...
...
@@ -160,7 +160,7 @@ private slots:
void
postCommandSequence
(
unsigned
mask
);
void
operateByInstructionTriggered
(
bool
);
void
consoleStub
Message
(
const
QString
&
,
bool
);
void
consoleStub
Error
(
const
QString
&
);
void
consoleStubProcessStarted
();
void
consoleStubExited
();
...
...
src/plugins/debugger/gdb/termgdbadapter.cpp
View file @
cfb232eb
...
...
@@ -70,7 +70,7 @@ TermGdbAdapter::TermGdbAdapter(GdbEngine *engine)
m_stubProc
.
setSettings
(
Core
::
ICore
::
instance
()
->
settings
());
#endif
connect
(
&
m_stubProc
,
SIGNAL
(
process
Message
(
QString
,
bool
)),
SLOT
(
stub
Message
(
QString
,
bool
)));
connect
(
&
m_stubProc
,
SIGNAL
(
process
Error
(
QString
)),
SLOT
(
stub
Error
(
QString
)));
connect
(
&
m_stubProc
,
SIGNAL
(
processStarted
()),
SLOT
(
handleInferiorSetupOk
()));
connect
(
&
m_stubProc
,
SIGNAL
(
wrapperStopped
()),
SLOT
(
stubExited
()));
}
...
...
@@ -207,7 +207,7 @@ void TermGdbAdapter::interruptInferior()
showMessage
(
_
(
"CANNOT INTERRUPT %1"
).
arg
(
attachedPID
));
}
void
TermGdbAdapter
::
stub
Message
(
const
QString
&
msg
,
bool
)
void
TermGdbAdapter
::
stub
Error
(
const
QString
&
msg
)
{
showMessageBox
(
QMessageBox
::
Critical
,
tr
(
"Debugger Error"
),
msg
);
}
...
...
src/plugins/debugger/gdb/termgdbadapter.h
View file @
cfb232eb
...
...
@@ -74,7 +74,7 @@ private:
Q_SLOT
void
handleInferiorSetupOk
();
Q_SLOT
void
stubExited
();
Q_SLOT
void
stub
Message
(
const
QString
&
msg
,
bool
isError
);
Q_SLOT
void
stub
Error
(
const
QString
&
msg
);
Utils
::
ConsoleProcess
m_stubProc
;
LocalGdbProcess
m_gdbProc
;
...
...
src/plugins/projectexplorer/applicationlauncher.cpp
View file @
cfb232eb
...
...
@@ -103,8 +103,8 @@ ApplicationLauncher::ApplicationLauncher(QObject *parent)
#ifdef Q_OS_UNIX
d
->
m_consoleProcess
.
setSettings
(
Core
::
ICore
::
instance
()
->
settings
());
#endif
connect
(
&
d
->
m_consoleProcess
,
SIGNAL
(
process
Message
(
QString
,
bool
)),
this
,
SLOT
(
appendProcessMessage
(
QString
,
bool
)));
connect
(
&
d
->
m_consoleProcess
,
SIGNAL
(
process
Error
(
QString
)),
this
,
SLOT
(
consoleProcessError
(
QString
)));
connect
(
&
d
->
m_consoleProcess
,
SIGNAL
(
processStopped
()),
this
,
SLOT
(
processStopped
()));
...
...
@@ -118,11 +118,6 @@ ApplicationLauncher::~ApplicationLauncher()
{
}
void
ApplicationLauncher
::
appendProcessMessage
(
const
QString
&
output
,
bool
onStdErr
)
{
emit
appendMessage
(
output
,
onStdErr
?
Utils
::
ErrorMessageFormat
:
Utils
::
NormalMessageFormat
);
}
void
ApplicationLauncher
::
setWorkingDirectory
(
const
QString
&
dir
)
{
#ifdef Q_OS_WIN
...
...
@@ -223,6 +218,11 @@ void ApplicationLauncher::guiProcessError()
emit
processExited
(
d
->
m_guiProcess
.
exitCode
());
}
void
ApplicationLauncher
::
consoleProcessError
(
const
QString
&
error
)
{
emit
appendMessage
(
error
+
QLatin1Char
(
'\n'
),
Utils
::
ErrorMessageFormat
);
}
void
ApplicationLauncher
::
readStandardOutput
()
{
QByteArray
data
=
d
->
m_guiProcess
.
readAllStandardOutput
();
...
...
src/plugins/projectexplorer/applicationlauncher.h
View file @
cfb232eb
...
...
@@ -78,8 +78,8 @@ signals:
private
slots
:
void
processStopped
();
void
appendProcessMessage
(
const
QString
&
output
,
bool
onStdErr
);
void
guiProcessError
();
void
consoleProcessError
(
const
QString
&
error
);
void
readStandardOutput
();
void
readStandardError
();
#ifdef Q_OS_WIN
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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