[SOLVED] run_nofatal() never finishes

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
sebastien4444
Messages: 22
Registration: Sep 14, 2023 - 08:53

June 7, 2024 - 5:58 PM

Hello,

I'm having a small problem with this function.

I need to install a file from an .exe, to which I must provide the /verysilent parameter for silent installation.
Since the install_exe_if_needed function doesn't seem to allow adding parameters (like install_msi_if_needed does with properties), I'm using run_as_administrator(myfile.exe, params="/verysilent").

Following that, I need to copy files to the directory where the software was installed, so the installation must be complete for the copy path to exist. Therefore, I'm using wait_uninstallkey_present() with the uninstallation key.

Finally, I need to launch an .exe file located in the installation directory to start the service on the PC.
Since this .exe doesn't return an exit code, I'm using run_nofatal() to avoid an error.

My problem is that my .exe file runs correctly because I see the service appear on my machine, but the print("starting OK") that I add immediately afterward is never displayed; therefore, the installation execution never finishes.

Isn't the purpose of this function precisely to execute and exit without waiting for anything?
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

June 7, 2024 - 6:22 PM

sebastien4444 wrote: June 7, 2024 - 5:58 PM Since the install_exe_if_needed function does not seem to allow adding parameters (as install_msi_if_needed does with properties), I use run_as_administrator(myfile.exe, params="/verysilent").
You can send your setup.py file; that will be simpler

and if install_exe_if_needed allows adding an argument with silentflags:

Example with VLC:

Code: Select all

    install_exe_if_needed("vlcsetup.exe",silentflags="/S",key="VLC media player",min_version="3.0.20")

run_as_administrator should not be used in packages since wapt launches a system account and is therefore unnecessary.
just use run
sebastien4444
Messages: 22
Registration: Sep 14, 2023 - 08:53

June 10, 2024 - 11:25

Hello,

Thank you for your feedback.

Indeed, during the installation, I hadn't noticed the presence of the silent flag parameter in `install_exe_if_needed`. :oops:

However, this doesn't solve my problem with launching the .exe file. :?

By using `run()` instead of `run_as_administrator()`, my service does start (as when I used `run_nofatal`), but the script execution gets stuck at that line and therefore doesn't finish (so if I build the package as is and deploy it to a PC, the installation never completes).

Thank you in advance for your feedback.
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

June 10, 2024 - 11:46

You can send your setup.py file; that will be simpler ;)
sebastien4444
Messages: 22
Registration: Sep 14, 2023 - 08:53

June 11, 2024 - 09:44

Good morning,

Here's what it looks like:

Code: Select all

from setuphelpers import *

def install():
    install_exe = "UltraVNC Installer.exe"
    config_file = "ultravnc.ini"
    install_path = makepath("C:","Program Files","uvnc bvba","UltraVNC")
    service_path = makepath("C:","Program Files","uvnc bvba","UltraVNC","winvnc.exe")
    
    install_exe_if_needed(install_exe, , silentflags="/verysilent", key="Ultravnc2_is1")
   
    print("VNC installé")
   
    filecopyto(config_file, install_path)

    print("Config copiée")

    run(service_path)
    
    print("Service lancé")
The software installs, the config file is copied correctly, the service starts correctly but the "Service started" print statement is never reached and the script only finishes after the timeout (and therefore with an error).
User avatar
dcardon
WAPT Expert
Messages: 1932
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

June 13, 2024 - 11:29

Hi Sébastien,

it's very likely that the execution of "winvnc.exe" isn't returning control (basically, it's not running as a service), and therefore the run() function isn't returning control. After the timeout, it will kill the runnable winvnc.exe, and the package will run into an error.

There's probably a way to declare winvnc as a service and run it as such to avoid this blocking issue.

Regards,

Denis
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
sebastien4444
Messages: 22
Registration: Sep 14, 2023 - 08:53

June 14, 2024 - 11:46

Hello,

thank you for your reply.

Yes, that's it, as soon as the error is raised, the program stops.

I've tried different Python functions from various libraries that allow file execution, and it doesn't change anything.

The strange thing is that launching winvnc.exe via a command prompt doesn't cause this problem: the program starts, I get the prompt almost instantly, and the program remains active.
I thought execution functions in Python were the same as launching a cmd command.

Oh well, I'll do it another way. Thanks again.
User avatar
dcardon
WAPT Expert
Messages: 1932
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

June 14, 2024 - 12:35

Hi again Sébastien,

have you taken a look at the package we have on the store

https://wapt.tranquil.it/store/en/detai ... _PROD.wapt?

If the goal is to run it as a service, this is the best way to do it.

Otherwise, if you really need to replicate the behavior of launching a command in the background, you can look at the "start" command line.

Best regards,

Denis
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
sebastien4444
Messages: 22
Registration: Sep 14, 2023 - 08:53

June 14, 2024 - 3:50 PM

Great, thanks!

Looking at the setup.py file in your package, I saw that I needed to add the "-install" parameter to the execution of winvnc.exe (which is actually in the UltraVNC "Command Line" documentation, but I had missed it :? ).
User avatar
dcardon
WAPT Expert
Messages: 1932
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

June 17, 2024 - 09:49

Hi Sébastien,

thanks for your feedback :-) . Glad you found a solution.

Feel free to spread the word about WAPT; it also spreads a lot through word of mouth :-) !

Best regards,

Denis
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
Locked