Page 1 of 1

[SOLVED] The session-setup function does not run automatically

Published: Dec 24, 2024 - 3:20 PM
by brice73
Good morning,

I'm having a problem with the `session_setup()` function, which isn't running automatically. We've upgraded to the latest version of WAPT Enterprise 2.6.0.016613, and so far I've only tested the package in question, which works except for the `session_setup()` function. The behavior is actually quite strange:

- If a user is logged in during package installation, the session_setup function will run correctly for that user only, after the package is installed. However, it will not run when other users log in.

- If no user is logged in, after installing the package and logging into the machine, the function does not execute (although I did see the WAPT icon briefly appear in the taskbar during login). However, if I open a command prompt and run `wapt-get session-setup "package name"`, the `session-setup` function then executes without any problem! I don't understand why it doesn't execute automatically at login, whereas it can be executed manually.

In both cases, the behavior is the same as for a user who logs in as either an administrator or a standard user. The behavior is also the same under Windows 11 or Windows 10.

I tried to look at the WAPT agent settings but did not see any settings in the documentation that affect the session-setup function, so I did not notice anything special in the agent settings on the workstations (wapt-get.ini file).

The session_setup() function that is called is as follows:

Code: Select all

def session_setup():

    import os

    mkdirs(makepath(user_home_directory(),'.arduinoIDE'))

    with open(r'C:\cachefileWAPT\arduino-ide\arduino-cli.yaml', "r", encoding='utf-8') as fichier:
        data = fichier.read()

    data_modified=data.replace('username',os.environ['USERNAME'])

    with open(makepath(user_home_directory(),'.arduinoIDE','arduino-cli.yaml'), "w", encoding='utf-8') as fichier:
        fichier.write(data_modified)

    filecopyto(r'C:\cachefileWAPT\arduino-ide\settings.json',makepath(user_home_directory(),'.arduinoIDE'))

Apart from this single problem of the non-automatic launch of the session_setup function when a session is opened, the package works and the application installed and configured by it is functional (if the session_setup function is executed manually).

Could you help me solve this problem?
Best regards

Re: Session-setup function not running automatically

Published: Dec 26, 2024 - 08:43
by jlepiquet
Good morning,

This is a known bug on our end; the --hide parameter in the launched command is malfunctioning.

This issue is fixed in version 2.6.16714, which you can upgrade to.

Otherwise, here is the process to follow:
In

Code: Select all

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\WAPT session setup
Remove the --hide from the shortcut path

Code: Select all

"C:\Program Files (x86)\wapt\wapt-get.exe" session-setup ALL --hide

Code: Select all

"C:\Program Files (x86)\wapt\wapt-get.exe" session-setup ALL
And the Python code that automates this:

Code: Select all

start_menu_path = start_menu(1) # C:\\ProgramData\\Microsoft\\Windows\\Start Menu 
wapt_session_setup_shortcut = makepath(start_menu_path, 'Programs', 'Startup', 'WAPT session setup.lnk') 
r = winshell.Shortcut(wapt_session_setup_shortcut) 
r.arguments = r.arguments.replace(' --hide', '') 
r.write()

Re: Session-setup function not running automatically

Published: Dec 26, 2024 - 2:33 PM
by brice73
Hello,

Thank you so much for your quick reply! :)

I'm glad to know that you identified this bug and that it's fixed in a new version of WAPT. We'll be installing it very soon. Thank you also for the temporary Python automation workaround.

Best regards