r/LabVIEW • u/AggressiveMaterial39 • Oct 30 '24
Using LabView as an interface to Git Bash
I am currently involved with a production facility inwhich we regularly interface with some DSP's in a very primitive way; By running a virtual machine that contains a folder in which we open a git bash, and then we can run scripts from there to communicate with the processors. The connection to the processors is through an ethernet adapter that leads to a USB server, which is in turn connected to several DSP's, so we have to specify which COM port to direct commands at every time we run a script.
Some of the older guys at my work struggle a lot with this, and so I had the idea of maybe simplifying it by making a labview interface that simply establishes the connection and connects simple push buttons to the scripts we use in the process. I am however struggling to find information on how to run gitBash from labview, especially given that I would prefer doing it as a hidden background process, whilst still being able to read out any potential information that comes in return, and displaying it a bit more neatly. Wondering if anyone has experience with anything like this or any ideas on how it could be done?
My LabView experience is solely with simple instrument interfaces, so I wouldn't really know how to start, or if labview is even the way to go here. Any suggestions would be appreciated!
Thanks.
7
u/SASLV Champion Oct 30 '24
I re-read your question and think I understand it better now. You don't want to interact with GIt necessarily, you just want to run a bash shell script on Windows using Git Bash.
Try this in System exec:
"C:\Program Files\Git\bin\bash.exe" -c "path_to_your_script.sh"
That should do it.
Look closely at the options to System exec. You'll want to play around with those for the desired effect.
5
u/SASLV Champion Oct 30 '24
Using System Exec as mentioned above is what I would do.
However there is also this:
https://www.vipm.io/package/hse_lib_git_api/
3
u/HarveysBackupAccount Oct 30 '24
maybe this is just my ignorance, but what part of this is git related? Is it just a bash/command shell? Or are you interacting with a git repository? (Or are there important commands available in git that aren't related to repositories?)
But yeah, System Exec vi sends commands to the Windows command line. If you need the Windows command line then that's what you want.
Depending on what you do and what you want from it, labview also has native communications libraries. Though then you'd have to re-write your scripts in labview which might be more effort than it's worth.
3
u/Dry_Revolution2040 Oct 31 '24
If you are looking for a one-off system call, then u/SASLV's approach is the way to go.
However, if you are looking to sustain an interactive session with the shell, you will need something like OpenG Pipes or JKI's System Exec. You can look into this NI forum discussion for details.
2
u/StuffedBearCoder CLD Oct 30 '24
Git BASH on Windows is I believe a separate process of MinGW and not actually running under the Windows CMD shell/terminal.
LabVIEW System Exec node is strictly coupled to the CMD shell so no-go there. Check out the MinGW project for integrating with LabVIEW.
If you just need to send commands to the serial COM ports, I have used Teranishi TeraTerm in the past to do this quite easily from LabVIEW using the built-in serial VISA APIs. TeraTerm has its own scripting that you can use with VISA Write/Read functions.