Sourcing a script using QProcess
Unsolved
General and Desktop
-
Try with
p.start("bash", QStringList() << "-c" << "\"\"source /path/to/test.sh\"\"");
-
How are you checking that it does nothing with QProcess ?
In the console version you have too much quotes it should only be
bash -c "source /path/to/test.sh"
-
How are you checking that it does nothing with QProcess ?
The env vars are not exported and there is no echo.
In the console version you have too much quotes it should only be bash -c "source /path/to/test.sh"
Yes, in this way the echo is shown but the vars are not exported. It's the same as run the script directly without sourcing it. But it's beyond my knowledge to understand why.
-
On OS X putting the echo call inside the "command string" worked.
I'm reading stdout using readAllStandardOutput
-
You can set the environment using
QProcess::setProcessEnvironment(const QProcessEnvironment & environment)
You can get the environment of your current process via
QProcessEnvironment::systemEnvironment()