This is an automated email from the ASF dual-hosted git repository.

lfrolov pushed a commit to branch DATALAB-2551
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git


The following commit(s) were added to refs/heads/DATALAB-2551 by this push:
     new 1a7321ca1 [DATALAB-2551]: changed how console command is executed
1a7321ca1 is described below

commit 1a7321ca1645624a0c92061bcd827f38ee890676
Author: leonidfrolov <[email protected]>
AuthorDate: Wed May 25 16:11:17 2022 +0300

    [DATALAB-2551]: changed how console command is executed
---
 .../terraform/bin/datalab.py                       | 23 +++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/infrastructure-provisioning/terraform/bin/datalab.py 
b/infrastructure-provisioning/terraform/bin/datalab.py
index ff6c9f361..624233284 100644
--- a/infrastructure-provisioning/terraform/bin/datalab.py
+++ b/infrastructure-provisioning/terraform/bin/datalab.py
@@ -191,17 +191,18 @@ class Console:
         Returns:
             str: command result
         """
-        process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE,
-                                   stderr=subprocess.STDOUT,
-                                   universal_newlines=True)
-
-        while True:
-            nextline = process.stdout.readline()
-            print(nextline)
-            if nextline == '' and process.poll() is not None:
-                break
-            if 'error' in nextline.lower():
-                sys.exit(0)
+        # process = subprocess.Popen(command, shell=True, 
stdout=subprocess.PIPE,
+        #                            stderr=subprocess.STDOUT,
+        #                            universal_newlines=True)
+        subprocess.run(command, shell=True, check=True)
+
+        # while True:
+        #     nextline = process.stdout.readline()
+        #     print(nextline)
+        #     if nextline == '' and process.poll() is not None:
+        #         break
+        #     if 'error' in nextline.lower():
+        #         sys.exit(0)
 
     @staticmethod
     def execute(command):


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to