From 6c07a47873a64d47b32740aeb48e6dfc60da34a8 Mon Sep 17 00:00:00 2001
From: Raman Arora <raman@basistech.com>
Date: Wed, 29 Jul 2020 13:20:30 -0400
Subject: [PATCH] Get the TSK_HOME env variable before using it.

---
 win32/updateAndBuildAll.py | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/win32/updateAndBuildAll.py b/win32/updateAndBuildAll.py
index da6b3cb88..afd419a28 100644
--- a/win32/updateAndBuildAll.py
+++ b/win32/updateAndBuildAll.py
@@ -73,17 +73,18 @@ def pullAndBuildAllDependencies(depBranch):
 
     # get all nuget packages needed by the solution
     if(passed):
+        TSK_HOME = os.getenv("TSK_HOME", False)
         if not TSK_HOME:
             print("Please set the TSK_HOME environment variable")
             sys.exit(1)
         else:
+            # nuget restore 
             os.chdir(os.path.join(os.getenv("TSK_HOME"),"win32"))
-
-        # nuget restore
-        print ("Restoring nuget packages.")
-        ret = subprocess.call(["nuget", "restore", "tsk-win.sln"] , stdout=sys.stdout)
-        if ret != 0:
-            sys.exit("Failed to restore nuget packages")
+            
+            print ("Restoring nuget packages.")
+            ret = subprocess.call(["nuget", "restore", "tsk-win.sln"] , stdout=sys.stdout)
+            if ret != 0:
+                sys.exit("Failed to restore nuget packages")
                  
 
 def buildTSKAll():
-- 
GitLab