boltops-tools / terraspace

Terraspace: The Terraform Framework
https://terraspace.cloud
Apache License 2.0
674 stars 46 forks source link

Do not use `fork()` when concurrency is `1` #206

Closed CumpsD closed 2 years ago

CumpsD commented 2 years ago

Checklist

My Environment

Software Version
Operating System Windows
Terraform 1.1.5
Terraspace 1.1.2
Ruby 3.1.0

Expected Behaviour

Running an all command on Windows should work.

Current Behavior

all commands do not work because fork() does not exist on Windows

terraspace all show
Running:
    terraspace show backend # batch 1
Batch Run 1:
C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/terraspace-1.1.2/lib/terraspace/all/runner.rb:44:in `fork': fork() function is unimplemented on this machine (NotImplementedError)

Setting config.all.concurrency = 1 still uses fork, so cannot be used as a workaround.

Solution Suggestion

Find a way to make fork() work on Windows, or skip fork() when concurrency is set to 1

tongueroo commented 2 years ago

Done in #207

Had some mixed feelings here and almost did not do this. Some thoughts:

Not forking when config.all.concurrency = 1 seems like a simple way to address this, but has it's own issues:

Would like to try getting "Windows forking" working. Here's some starter research.

CumpsD commented 2 years ago

I understand your reasoning behind keeping the code simple, and agree completely :) I hope you find a clean way 🤞🏻