QProcess changes command behavior
-
The following command works fine from a bash command line:
/bin/udevadm info -q all -a /dev/mapper/almalinux_dev--almalinux9-root
But when run using QProcess is returns the error
Unknown device "/sys//dev/mapper/almalinux_dev--almalinux9-root": No such device
so it would appear that somehow "/sys/" is being prepended to the path. But why? If it works from the command line shouldn't it work fine launched with QProcess? (The passed environment to QProcess is blank)
I repeated the command from bash using "env -i" first and it runs fine with no environment specified. This seems very strange, but I confirmed the parameters passed to the QProcess are correct. I assume QProcess is doing something different when it launches the command...but what?
-
The following command works fine from a bash command line:
/bin/udevadm info -q all -a /dev/mapper/almalinux_dev--almalinux9-root
But when run using QProcess is returns the error
Unknown device "/sys//dev/mapper/almalinux_dev--almalinux9-root": No such device
so it would appear that somehow "/sys/" is being prepended to the path. But why? If it works from the command line shouldn't it work fine launched with QProcess? (The passed environment to QProcess is blank)
I repeated the command from bash using "env -i" first and it runs fine with no environment specified. This seems very strange, but I confirmed the parameters passed to the QProcess are correct. I assume QProcess is doing something different when it launches the command...but what?
QProcess only does what you tell them to do. It will not add anything. So please show us your code.
-
QProcess only does what you tell them to do. It will not add anything. So please show us your code.
@Christian-Ehrlicher is right. We need to see your code. Most of the time there is misunderstandings in how to provide command line parameters to QProcess.