You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 23, 2021. It is now read-only.
I have a homebrew script to switch between php versions on my macbook.
You can't execute the script with sudo, so the normal command would be phpswitch.sh 70 in order to switch to php 7.0.
But at the end of the script the apache config is updated and the apache will be restarted. So the script needs root rights.
I search for some workaround and I found the possibility to call sudo -v first, so the root password is prompted and then executing the phpswitch script, because then the timestamp for sudo is already valid.
Now the problem with this workaround: with your package I cant call sudo.exec('sudo -v') nor sudo.exec('-v').
Do you have any idea how I could achieve this?
Thanks in advance!
The text was updated successfully, but these errors were encountered:
If I understand correctly, do you want to do the following?
# Get the sudo session established for the next few minutes:
sudo -v
# Run the following script without sudo for the most part.
# Within this script there is a command prefixed with sudo to restart apache.
./phpswitch.sh 70
sudo-prompt already does an equivalent of sudo -v when it runs, to try and keep the user's sudo session alive for the next time exec() is called. However, TTY tickets are now enabled by default from macOS Sierra on, so this does not help since each exec() call is run in a new TTY.
I would recommend extracting the sudo command from your script and running it using sudo-prompt, e.g.:
Hey there,
thanks for this awesome package!
I have a homebrew script to switch between php versions on my macbook.
You can't execute the script with sudo, so the normal command would be
phpswitch.sh 70
in order to switch to php 7.0.But at the end of the script the apache config is updated and the apache will be restarted. So the script needs root rights.
I search for some workaround and I found the possibility to call
sudo -v
first, so the root password is prompted and then executing the phpswitch script, because then the timestamp for sudo is already valid.Now the problem with this workaround: with your package I cant call
sudo.exec('sudo -v')
norsudo.exec('-v')
.Do you have any idea how I could achieve this?
Thanks in advance!
The text was updated successfully, but these errors were encountered: