G2A Many GEOs
SHARE
TWEET

var references in groovy closures

a guest Feb 28th, 2017 123 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //slaves
  2. def machines = ['a', 'b', 'c']
  3.  
  4. //container
  5. def ds = [:]
  6.  
  7. for (machine in machines) {
  8.         //prints "Adding entry a\n...Adding entry b\n..." as expected
  9.         print("Adding entry for: " + machine);
  10.  
  11.         ds[machine] = {download_builds( machine )}; //entry is added, apparently.
  12.     }
  13.  
  14. //execute all closures in hash ds concurrently
  15. parallel ds;
  16.  
  17. //They all execute download_builds('c'); ... ?  Because the last assignment made to 'machine' was 'c'?
RAW Paste Data
Ledger Nano X - The secure hardware wallet
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top