can I execute cmd commands in a pulumi program? I ...
# general
f
can I execute cmd commands in a pulumi program? I would like to
git clone
a helm chart and run it after
b
yeah just make sure its awaited or synchronous and it will all be fine just like any other app
f
what’s the… module / syntax to execute a command?
b
import child_process i guess
f
oh, so like a node app? 🤔
there is a Module called cmd in pulumi not sure
b
if you're using typescript/node you'd use that yeah, python use whatever the equivalent is
c
oh, so like a node app?
Yes, for JS and TS. Here’s an example from a recent personal project of mine: https://github.com/praneetloke/GarageDoorMonitor/blob/master/infrastructure/projectBuilder.ts. I am invoking
dotnet publish
, though I am doing it using the synchronous version of
spawn
. I am doing that because the async version only accepts a callback and not async/await, which would have required me to create a promise and manually resolve/reject the promise. I didn’t want to do all that, but you could if you wanted to. I also think synchronous exec is fine here.
🔥 1
f
@clever-sunset-76585 this is exactly what I wanted, thanks for the example!
👍 1