Commit 273448af authored by Harald Sitter's avatar Harald Sitter 🏳️‍🌈 Committed by Albert Astals Cid
Browse files

move shell argument manipulation to session

we need this to happen before KSandbox::makeHostContext because the
first argument is not necessarily the shell command anymore afterwards,
confusing the legacy logic inside Pty. simply move the manipulation into
Session.cpp

this should make the flatpak build work properly
parent b733bd03
Pipeline #261643 passed with stage
in 6 minutes and 10 seconds
......@@ -258,11 +258,7 @@ int Pty::start(const QString &programName, const QStringList &programArguments,
{
clearProgram();
// For historical reasons, the first argument in programArguments is the
// name of the program to execute, so create a list consisting of all
// but the first argument to pass to setProgram()
Q_ASSERT(programArguments.count() >= 1);
setProgram(programName, programArguments.mid(1));
setProgram(programName, programArguments);
addEnvironmentVariables(environmentList);
......
......@@ -468,6 +468,11 @@ void Session::run()
// if no arguments are specified, fall back to program name
QStringList arguments = _arguments.join(QLatin1Char(' ')).isEmpty() ? QStringList() << exec : _arguments;
// For historical reasons, the first argument in _arguments is the
// name of the program to execute, remove it in favor of the actual program name
Q_ASSERT(arguments.count() >= 1);
arguments = arguments.mid(1);
if (!_initialWorkingDir.isEmpty()) {
_shellProcess->setInitialWorkingDirectory(_initialWorkingDir);
} else {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment