Fork me on GitHub
#babashka
<
2022-11-16
>
jackmoch18:11:36

Hello! I’m experimenting with some babashka scripting and am having trouble diagnosing a problem. I’m attempting to pull an Openshift ConfigMap via their CLI tool and output it as JSON Everything works as expected when running this with “smaller” (say 1 - 10 KB) configMaps

(-> @(process "oc get configmap smaller-config-map -o json") :out slurp println)
But it just hangs with “larger” configMaps (131 KB is what I’ve seen fail so far but I’m trying to narrow the gap and figure out the threshold) When run from a terminal the oc get ... command behaves the same way regardless of which configMap is specified Are there any suggestions on how I could diagnose this or proceed?

borkdude18:11:39

@jackmoch Can you try (-> (shell {:out :string} "oc get configmap smaller-config-map -o json" ):out println) instead? Of since you just want to see the output:

(shell "oc get configmap smaller-config-map -o json")
should do it

borkdude18:11:22

if you remove the @ it should also work. The problem is that you're waiting for the process to end before you consume the stream, but when the buffer is full, the process can't continue

jackmoch18:11:17

Ah yes that’s exactly what I’m looking for! It sounds like I need to spend some more time with the process and shell docs…👀 Thank you @borkdude!

borkdude18:11:45

I think the README should probably emphasize shell more which is what people typically will use, probably