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
Marco Bubke
flatpak-qt-creator
Commits
72e083b4
Commit
72e083b4
authored
Jan 15, 2009
by
Oswald Buddenhagen
Browse files
fix xterm call incl. shell escaping
parent
fa435213
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/plugins/projectexplorer/consoleprocess_unix.cpp
View file @
72e083b4
...
...
@@ -46,29 +46,36 @@ ConsoleProcess::~ConsoleProcess()
{
}
static
QString
shellEscape
(
const
QString
&
in
)
{
QString
out
=
in
;
out
.
replace
(
'\''
,
"'
\'
'"
);
out
.
prepend
(
'\''
);
out
.
append
(
'\''
);
return
out
;
}
bool
ConsoleProcess
::
start
(
const
QString
&
program
,
const
QStringList
&
args
)
{
if
(
m_process
->
state
()
!=
QProcess
::
NotRunning
)
return
false
;
QString
shellArgs
;
shellArgs
+=
QLatin1String
(
"cd "
);
shellArgs
+=
workingDirectory
();
shellArgs
+=
shellEscape
(
workingDirectory
()
)
;
shellArgs
+=
QLatin1Char
(
';'
);
shellArgs
+=
program
;
shellArgs
+=
shellEscape
(
program
)
;
foreach
(
const
QString
&
arg
,
args
)
{
shellArgs
+=
QLatin1Char
(
' '
);
shellArgs
+=
QLatin1Char
(
'\''
);
shellArgs
+=
arg
;
shellArgs
+=
QLatin1Char
(
'\''
);
shellArgs
+=
shellEscape
(
arg
);
}
shellArgs
+=
QLatin1String
(
"; echo; echo
\"
Press enter to close this window
\"
; read"
);
shellArgs
+=
QLatin1String
(
"; echo; echo
\"
Press enter to close this window
\"
; read
DUMMY
"
);
m_process
->
setEnvironment
(
environment
());
connect
(
m_process
,
SIGNAL
(
finished
(
int
,
QProcess
::
ExitStatus
)),
this
,
SLOT
(
processFinished
(
int
,
QProcess
::
ExitStatus
)));
m_process
->
start
(
QLatin1String
(
"xterm"
),
QStringList
()
<<
QLatin1String
(
"-e"
)
<<
shellArgs
);
m_process
->
start
(
QLatin1String
(
"xterm"
),
QStringList
()
<<
QLatin1String
(
"-e"
)
<<
"/bin/sh"
<<
"-c"
<<
shellArgs
);
if
(
!
m_process
->
waitForStarted
())
return
false
;
emit
processStarted
();
...
...
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