Hi,
related to: execute_process buffers and doesn't print question when process is waiting on user input.
My goal is to add a path to user PATH environment variable during installation process but I want to request his permission first.
A workaround would be to set an option for cmake command line but it’s not user friendly as he must allow (or disallow) at configuration step for the manipulation, which is disconnect from installation time.
Regards
A.
1 Like
For my specific use case, I add a bit of context that may be significant to solve the issue.
In my project CMakeLists.txt:
INSTALL(SCRIPT ".../MyInstallScript.cmake")
In MyInstallScript.cmake
execute_process(".../PromptUser.sh" OUTPUT_VARIABLE FOO RESULT_VARIABLE FOOR ERROR_VARIABLE FOO_ER)
In PromptUser.sh
#/usr/bin/env bash
while true; do
read -p "Do you want to go on? (yn) " yn
case $yn in
[yY] ) echo "go on";
exit 0;;
[nN] ) echo "stop";
exit 1;;
* ) echo "invalid response";;
esac
done
read prompt is not displayed and echo command are buffered into FOO but not displayed.
besides in this case all echo are buffered, whereas I would be interested only in the last echo (for instance: “stop” instead of “invalid response invalid response invalid response invalid response stop”)
Thanks.
I don’t know that stdin
is forwarded properly for this kind of stuff. I have no idea what this means for cmake-gui
or ccmake
(in a full CMake run). Script mode might be able to support it, but it sounds new to me.