LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling GIT via System Exec.vi returns wrong results when called using LabVIEW CLI

Solved!
Go to solution

Hello forums,

 

I'm using LabVIEW CLI to trigger my VIAnalyzer task, as part of the custom interface I've built I have a VI that uses git to compare the changes between my current branch and 'origin/develop'. The idea being that I would run VIAnalyzer only on the changeset for a PR. The VI itself runs a number of git commands via "System Exec.vi" in order to determine changes between the current branch and 'origin/develop'.

 

The problem is the git commands don't run properly when run from LabVIEW CLI... I'm not sure what I'm doing wrong but I'm guessing it has something to do with the LabVIEWCLI sandbox, when I run the same VI directly from the LabVIEW IDE it runs without issue. It seems that LabVIEWCLI can run git commands but the output from those git commands are different than when run from the IDE.

 

GITListChangedFiles.png

 

I have tried prefixing the commands with 'cmd /c', and 'powershell' but I get the same issue.

 

Any help/insights much appreciated.

 

Cheers,

 

Paul

0 Kudos
Message 1 of 5
(2,241 Views)

Hi Paul,

 

What do they return? Could it be a current directory issue?  What if you run a test that just returns CWD?

 

That would be my next step. I'm not familiar with LabVIEWCLIs handling of this.

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are at devs.wiresmithtech.com
Message 2 of 5
(2,207 Views)
Solution
Accepted by topic author AudioVideoDisco

Aha

 

Thanks for the debugging tip Mac, that's helped me find the root of the issue.

Turns out the output paths from the git commands weren't being converted properly by the Conditional Disable structure - it wasn't changing the forward slashes to backward slashes when run from LabVIEWCLI. According to the documentation for the Conditional Disable structure the "OS" symbol "Specifies the OS on which the subdiagram executes. The VI must be in a LabVIEW project to access this symbol." - TIL
Considering LabVIEWCLI doesn't load the project (just the class) the conditional disable structure wasn't able to determine the OS and was executing the default case.

 

AudioVideoDisco_0-1657224804007.png

AudioVideoDisco_1-1657224818874.png

 

 

Workaround for now is to set OS == Win as the default case for the conditional disable structure and assume that we are always running our CI pipeline on a windows machine. The other option is to use some other way to determine OS or to add an OS input to the interface.

AudioVideoDisco_2-1657224851614.png

 

Thanks 🙌

 

 

Message 3 of 5
(2,185 Views)
Solution
Accepted by topic author AudioVideoDisco

The proper wodkaround would be a runtime check rather than a compile time check, which is what the Conditional Compile structure does.

Drop a LabVIEW property node, make siure it is of type LabVIEW VI Server:Application, then select the appropriate property OS:Platform (or something similar, I’m posting from my phone, which has no LabVIEW installed 😀).

Rolf Kalbermatter
My Blog
Message 4 of 5
(2,157 Views)

I would not have considered that they only work in the project (although it makes sense now it is pointed out!)

 

Good find and thanks for sharing.

James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are at devs.wiresmithtech.com
0 Kudos
Message 5 of 5
(2,147 Views)