VMware Cloud Community
Akhotchenkov
Contributor
Contributor

HTTPGet don`t close file

Hello, seems i found a bug. I have the follow action :

<showProgressDialog>
<explanation>explanation</explanation>
<progressText>progressText</progressText>
<title>title</title>
<actionList>
<httpGet>
<filename>${system_temp_directory}/file.file</filename>

<url>https:/some-url/file.file</url>
<onErrorActionList>
<deleteFile>
<path>${system_temp_directory}/${system_temp_directory}/file.file</path>
<show>0</show>
<ruleList>
<fileExists>
<path>${system_temp_directory}/${system_temp_directory}/file.file</path>
</fileExists>
</ruleList>
</deleteFile>
</onErrorActionList>
</httpGet>
</actionList>
</showProgressDialog>

 

If i close the progress dialog manually i can`t delete file in installationAbortedActionList file will be locked

Reply
0 Kudos
7 Replies
michieldhont_
Hot Shot
Hot Shot

Hi @Akhotchenkov,

In the <onErrorActionList> the file is still used by the httpGet action. Could you try <deleteFile> after running the <httpGet> action?

 

<deleteFile>
  <path>${system_temp_directory}/${system_temp_directory}/file.file</path>
  <show>0</show>
  <ruleList>
   <fileExists>
    <path>${system_temp_directory}/${system_temp_directory}/file.file</path>
   </fileExists>
 </ruleList>
</deleteFile>
Reply
0 Kudos
Akhotchenkov
Contributor
Contributor

Hi @michieldhont_ i tried your solution and its doesn`t work unfortunately, file still on block, but on osx all removing fine.

Reply
0 Kudos
michieldhont_
Hot Shot
Hot Shot

Hi @Akhotchenkov

Could you share a snippet reproducing the issue?

Regards,

Michiel

Reply
0 Kudos
Akhotchenkov
Contributor
Contributor

 <showProgressDialog>
    <title>${msg(download.@INSTALLER_FILE_NAME@.title)}</title>
    <width>400</width>
    <actionList>
        <httpGet>
            <abortOnError>@ABORT_ON_ERROR@</abortOnError>
            <filename>${system_temp_directory}/@INSTALLER_FILE_NAME@.dmg</filename>
            <url>@DOWNLOAD_BASE_URL@/x64/@INSTALLER_FILE_NAME@.dmg</url>
            <onErrorActionList>
                <setInstallerVariable>
                    <name>download_error_@INSTALLER_FILE_NAME@</name>
                    <value>true</value>
                </setInstallerVariable>
                <deleteFile>
                    <path>${system_temp_directory}/@INSTALLER_FILE_NAME@.dmg</path>
                    <show>0</show>
                    <ruleList>
                        <fileExists>
                            <path>${system_temp_directory}/@INSTALLER_FILE_NAME@.dmg</path>
                        </fileExists>
                        <platformTest>
                            <type>osx</type>
                        </platformTest>
                    </ruleList>
                </deleteFile>
            </onErrorActionList>
        </httpGet>
    </actionList>
    <ruleList>
        <platformTest>
            <type>osx</type>
        </platformTest>
        <checkFreeDiskSpace>
            <logic>greater</logic>
            <path>${system_temp_directory}</path>
            <size>300</size>
            <units>MB</units>
        </checkFreeDiskSpace>
    </ruleList>
</showProgressDialog>
<showProgressDialog>
    <title>${msg(download.@INSTALLER_FILE_NAME@.title)}</title>
    <width>400</width>
    <actionList>
        <httpGet>
            <abortOnError>@ABORT_ON_ERROR@</abortOnError>
            <filename>${system_temp_directory}/@INSTALLER_FILE_NAME@.exe</filename>
            <url>@DOWNLOAD_BASE_URL@/x32/@INSTALLER_FILE_NAME@.exe</url>
            <onErrorActionList>
                <setInstallerVariable>
                    <name>download_error_@INSTALLER_FILE_NAME@</name>
                    <value>true</value>
                </setInstallerVariable>
                <deleteFile>
                    <path>${system_temp_directory}/@INSTALLER_FILE_NAME@.exe</path>
                    <show>0</show>
                    <ruleList>
                        <fileExists>
                            <path>${system_temp_directory}/@INSTALLER_FILE_NAME@.exe</path>
                        </fileExists>
                    </ruleList>
                </deleteFile>
            </onErrorActionList>
        </httpGet>
    </actionList>
    <ruleList>
        <platformTest>
            <type>windows-x86</type>
        </platformTest>
        <checkFreeDiskSpace>
            <logic>greater</logic>
            <path>${system_temp_directory}</path>
            <size>300</size>
            <units>MB</units>
        </checkFreeDiskSpace>
    </ruleList>
</showProgressDialog>
<showProgressDialog>
    <title>${msg(download.@INSTALLER_FILE_NAME@.title)}</title>
    <width>400</width>
    <actionList>
        <httpGet>
            <abortOnError>@ABORT_ON_ERROR@</abortOnError>
            <filename>${system_temp_directory}/@INSTALLER_FILE_NAME@.exe</filename>
            <url>@DOWNLOAD_BASE_URL@/x64/@INSTALLER_FILE_NAME@.exe</url>
            <onErrorActionList>
                <setInstallerVariable>
                    <name>download_error_@INSTALLER_FILE_NAME@</name>
                    <value>true</value>
                </setInstallerVariable>
                <deleteFile>
                    <path>${system_temp_directory}/@INSTALLER_FILE_NAME@.exe</path>
                    <show>0</show>
                    <ruleList>
                        <fileExists>
                            <path>${system_temp_directory}/@INSTALLER_FILE_NAME@.exe</path>
                        </fileExists>
                    </ruleList>
                </deleteFile>
            </onErrorActionList>
        </httpGet>
    </actionList>
    <ruleList>
        <platformTest>
            <type>windows-x64</type>
        </platformTest>
    </ruleList>
</showProgressDialog>

 <installationAbortedActionList>
        <showProgressDialog>
            <title>${msg(aborted.title)}</title>
            <width>400</width>
                <actionList>
              <actionGroup>
    <actionList>
        <deleteFile>
            <path>${system_temp_directory}/@INSTALLER_FILE_NAME@.dmg</path>
                <ruleList>
                    <fileExists>
                        <path>${system_temp_directory}/@INSTALLER_FILE_NAME@.dmg</path>
                    </fileExists>
                    <platformTest>
                        <type>osx</type>
                    </platformTest>
                </ruleList>
        </deleteFile>
        <deleteFile>
            <path>${system_temp_directory}\@INSTALLER_FILE_NAME@.exe</path>
                <ruleList>
                    <fileExists>
                        <path>${system_temp_directory}\@INSTALLER_FILE_NAME@.exe</path>
                    </fileExists>
                    <platformTest>
                        <type>windows</type>
                    </platformTest>
                </ruleList>
        </deleteFile>
    </actionList>
</actionGroup>
                </actionList>
        </showProgressDialog>
    </installationAbortedActionList>

When i close a download window, opening the aborting dialog and download dialog will exist in background

Reply
0 Kudos
michieldhont_
Hot Shot
Hot Shot

Hi @Akhotchenkov,

The following example works for me on Windows. Could you try it?

        <httpGet>
            <url>https://file-examples-com.github.io/uploads/2018/04/file_example_AVI_1920_2_3MG.avi</url>
            <filename>${system_temp_directory}/sample.file</filename>
        </httpGet>
        <deleteFile>
            <path>${system_temp_directory}/sample.file</path>
            <ruleList>
                <fileExists>
                    <path>${system_temp_directory}/sample.file</path>
                </fileExists>
            </ruleList>
        </deleteFile>
Reply
0 Kudos
Akhotchenkov
Contributor
Contributor

Hi @michieldhont_ Yes this will work, but if this code paste to showProgressDialog, and then cancel it, file will not deleted

 

Try this example project, if you cancel the downloading, ${system_temp_directory}/sample.file will stay in ${system_temp_directory

<project>
    <shortName>sample</shortName>
    <fullName>Sample Project</fullName>
    <version>1.0</version>
    <componentList>
        <component>
            <name>default</name>
            <description>Default Component</description>
            <canBeEdited>1</canBeEdited>
            <selected>1</selected>
            <show>1</show>
            <folderList>
                <folder>
                    <description>Program Files</description>
                    <destination>${installdir}</destination>
                    <name>programfiles</name>
                    <platforms>all</platforms>
                    <shortcutList>
                        <shortcut>
                            <comment>Uninstall</comment>
                            <exec>${installdir}/${uninstallerName}</exec>
                            <icon></icon>
                            <name>Uninstall ${product_fullname}</name>
                            <path>${installdir}</path>
                            <platforms>all</platforms>
                            <runAsAdmin>0</runAsAdmin>
                            <runInTerminal>0</runInTerminal>
                            <windowsExec>${installdir}/${uninstallerName}.exe</windowsExec>
                            <windowsExecArgs></windowsExecArgs>
                            <windowsIcon></windowsIcon>
                            <windowsPath>${installdir}</windowsPath>
                        </shortcut>
                    </shortcutList>
                </folder>
                <folder>
                    <description>Program Files</description>
                    <destination>${installdir}</destination>
                    <name>programfileslinux</name>
                    <platforms>linux</platforms>
                </folder>
                <folder>
                    <description>Program Files</description>
                    <destination>${installdir}</destination>
                    <name>programfileslinux64</name>
                    <platforms>linux-x64</platforms>
                </folder>
                <folder>
                    <description>Program Files</description>
                    <destination>${installdir}</destination>
                    <name>programfileswindows</name>
                    <platforms>windows</platforms>
                </folder>
                <folder>
                    <description>Program Files</description>
                    <destination>${installdir}</destination>
                    <name>programfileswindows64</name>
                    <platforms>windows-x64</platforms>
                </folder>
                <folder>
                    <description>Program Files</description>
                    <destination>${installdir}</destination>
                    <name>programfilesosx</name>
                    <platforms>osx</platforms>
                </folder>
            </folderList>
            <startMenuShortcutList>
                <startMenuShortcut>
                    <comment>Uninstall ${product_fullname}</comment>
                    <name>Uninstall ${product_fullname}</name>
                    <runAsAdmin>0</runAsAdmin>
                    <runInTerminal>0</runInTerminal>
                    <windowsExec>${installdir}/${uninstallerName}.exe</windowsExec>
                    <windowsExecArgs></windowsExecArgs>
                    <windowsIcon></windowsIcon>
                    <windowsPath>${installdir}/</windowsPath>
                </startMenuShortcut>
            </startMenuShortcutList>
        </component>
    </componentList>
    <readyToInstallActionList>
        <showProgressDialog>
            <title>test</title>
            <actionList>
                <httpGet>
                    <filename>${system_temp_directory}/sample.file</filename>
                    <url>https://github.com/qt-creator/qt-creator/releases/download/v4.15.0-rc1/qtcreator-macOS-747779016.7z</url>
                </httpGet>
            </actionList>
        </showProgressDialog>
    </readyToInstallActionList>
    <enableRollback>1</enableRollback>
    <enableSslSupport>1</enableSslSupport>
    <enableTimestamp>1</enableTimestamp>
    <requestedExecutionLevel>asInvoker</requestedExecutionLevel>
    <vendor>123</vendor>
    <windows64bitMode>1</windows64bitMode>
    <installationAbortedActionList>
        <deleteFile>
            <path>${system_temp_directory}/sample.file</path>
            <ruleList>
                <fileExists>
                    <path>${system_temp_directory}/sample.file</path>
                </fileExists>
            </ruleList>
        </deleteFile>
    </installationAbortedActionList>
    <parameterList>
        <directoryParameter>
            <name>installdir</name>
            <description>Installer.Parameter.installdir.description</description>
            <explanation>Installer.Parameter.installdir.explanation</explanation>
            <value></value>
            <default>${platform_install_prefix}/${product_shortname}-${product_version}</default>
            <allowEmptyValue>0</allowEmptyValue>
            <ask>yes</ask>
            <cliOptionName>prefix</cliOptionName>
            <mustBeWritable>yes</mustBeWritable>
            <mustExist>0</mustExist>
            <width>30</width>
        </directoryParameter>
    </parameterList>
</project>

 

Reply
0 Kudos
michieldhont_
Hot Shot
Hot Shot

Hi @Akhotchenkov,

I've reproduced the issue. Could you open a ticket in private support so we can proceed to add it to our bug tracking system?

Regards,

Michiel

Reply
0 Kudos