TD 099 subproc to Windows Subsystem for Linux bash shell

The WSL / Windows Subsystem for Linux provides some interesting new developments for using *nix and gnu based tools natively in Windows 10.

I couldn’t seem to find a working method for getting a subprocess call from TouchDesigner to the WSL bash shell working.

I came up with a simple example to execute commands in bash but not to check and return stdout so I searched online and found a way.

The Python script in the TOE is based on the py snippets in the top answer by “eryksun” in this stackoverflow post. So credit largely goes to this user:
stackoverflow.com/questions/3981 … s-bash-exe

I could only get it working properly in 099 though I initially tried with 088… most likely a Python version compatibility issue.

Right now the method is a bit inefficient by writing a temporary file which is then read to check the stdout of our call. This causes a brief but significant frame drop in TD.
We aren’t able to pipe stdout directly to Python yet. Though that should be possible in the next major “Creator’s” update of Windows 10, (Or if you are already on an Insider build ver 14951 or later.)

Requirements:

  • TouchDesigner 099 (I’m on TD 099 build 2017.4580)
  • A 64-bit version of Windows 10 Anniversary Update build 14393 or later (I’m on Win 10 Pro x64 build 14393.953)
  • WSL installed per Microsoft’s instructions: msdn.microsoft.com/en-us/comman … tall_guide

Download example TOE:
TD099toWSLbash.toe (13.2 KB)

TD099toWSLbash_screenshot.png