Jump to content

Using cmd with Labview app build


Recommended Posts

Hi everybody,

 

I have a problem with cmd LabVIEW. I did a state machine and build an exe(So far, so good). 

I did a state machine with a 2000ms timeout. Everytime out i launch a cmd (So far, so good). This command consist to check if nvidia cuda is installed  (All is in the code and So far, so good).

 

image.png.ee2d5c3653915af9c8676455c5218f79.png

 

In my state machine i have a state which launch an external installer which will be installed cuda (So far, so good). 

 

image.png.baad6299e14ff0efc50070132185de41.png

 

My problem start when cuda is installed during the execution of this state machine (build in exe) and my timeout state does no work (the cmd which check if cuda is installed does not work).

When i restart the exe this state work ! and detect cuda with no problem 🤔

Why do i have to restart my exe to make it work ? (i put the state machine in snip copy and work well in LV version - Not work well when build exe)

1076015223_cmdsnipp.png.77337fe669e950ee01cc7fd0360226b5.png

 

CMD inside the exe are blocked since cuda installer was launched, why ?

 

If you want to do the test, just run the exe in the project, install cuda and when cuda is installed just see that it is not detected.
Restart the exe and there are no worries cuda is detected. 😭

I searched and I still haven't found out why   😭  😭  😭

 

217806318_SourceInstaller.zip

Edited by Youssef Menjour
Link to comment
22 minutes ago, Lipko said:

I think you should show all cases, maybe you would get replies from people you are not able to try your code at the moment (like me). We don't see where/how you set states apart from "4 - Display".

To answers you only need the two states explain upper.

If you want to see all cases you just have drag and drop on your labview diagram the sniped.

 

1076015223_cmdsnipp.png.77337fe669e950ee01cc7fd0360226b5.png

Link to comment
37 minutes ago, Youssef Menjour said:

If you want to see all cases you just have drag and drop on your labview diagram the sniped.

Snippets don't work very well and the meta information is stripped by some websites and browsers. It is always better to post the code.

3 hours ago, Youssef Menjour said:

CMD inside the exe are blocked since cuda installer was launched, why ?

Probably the "cmd /c where nvcc" isn't finishing for some reason (waiting for input?) and as you have the cmd VI set to wait until completion, it just gets stuck there.

Link to comment

i was 100 % sure you'll try ShaunR 😁

32 minutes ago, ShaunR said:

Snippets don't work very well and the meta information is stripped by some websites and browsers. It is always better to post the code.

 

code is posted upped (zip file with thewhole project), i put the code vi in attached.

Quote

Probably the "cmd /c where nvcc" isn't finishing for some reason (waiting for input?) and as you have the cmd VI set to wait until completion, it just gets stuck there.

This is not logical, this command works perfectly before installation and it works perfectly after installation and reboot of the exe


Nevertheless, I agree, there is an execution link. 
But then why in the .VI version it works and in the .exe version not at all? 🤔
 

Installer.vi

Link to comment
25 minutes ago, Youssef Menjour said:

But then why in the .VI version it works and in the .exe version not at all?

Maybe it requires privilege escalation because it's in an executable. Maybe it needs a confirmation to run the command. The only way you will know is to not hide the cmd window and run it with the "/k" switch so you can see what it's actually doing.

Edited by ShaunR
Link to comment

This might be an issue with environment variables. Your application runs with whatever environment variables exist at the time it was launched and cuda is only added to PATH during its installation.

Quote

By default, where searches the current directory and the paths that are specified in the PATH environment variable.

-- where | Microsoft Learn

It should work if you specify the path explicitly (or somehow reload environment variables).

Link to comment

Thank you

16 hours ago, LogMAN said:

This might be an issue with environment variables. Your application runs with whatever environment variables exist at the time it was launched and cuda is only added to PATH during its installation.

It should work if you specify the path explicitly (or somehow reload environment variables).

 

How to  reload in CMD environment variable ?

Edited by Youssef Menjour
Link to comment

"where" without parameters searches in the PATH (https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/where). That environment variable will not update unless you restart your process. (or you jump through some hoops (https://stackoverflow.com/questions/171588/is-there-a-command-to-refresh-environment-variables-from-the-command-prompt-in-w))

Try querying the registry for environment variables that the installer will create (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment).

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.