Is there a way to pipe commands into bluetoothctl through node-red?

I have a node-red project where I test the throughput of a bluetooth device, and this part is working fine. However when the test is concluded, I want to remove the device under test from blutoothctl, and have been running into problems getting this to work through node-red. Currently I have a function node that passes the payload "remove [device MAC]" to an exec node running bluetoothctl in spawn mode. This does not remove the device. This makes sense, because if I manually run the command "bluetoothctl remove [device MAC]" it doesn't get removed either.

I am able to successfully remove the device manually from the command line by running the following commands in succession:
1.) bluetoothctl
2.) remove [device MAC]

I can't imagine I'm the first person trying to do this...is there a way to pipe commands into bluetoothctl through node-red?

Here is what my exec node currently looks like:

Thanks!

You're not the only one who wants to use it programmatically.

Unless you need to use bluetoothctl, different tools can be used. Else you will have to write a script that uses expect to handle commandline interaction.