import os, time

def main():
    srvcmd = '%s --dbname "%s" --dbinit "include sql;"' % (os.getenv('MSERVER'),os.getenv('TSTDB'))
    srv = os.popen(srvcmd, 'w')
    time.sleep(10)                      # give server time to start
    cltcmd = os.getenv('SQL_CLIENT')
    clt = os.popen(cltcmd, 'w')
    clt.write('select 1;\n')
    clt.close()
    srv.close()

main()

import subprocess, os, time

def main():
    srvcmd = '%s --dbname "%s" --dbinit "include sql;"' % (os.getenv('MSERVER'),os.getenv('TSTDB'))
    srv = subprocess.Popen(srvcmd, shell = True, stdin = subprocess.PIPE)
    time.sleep(10)                      # give server time to start
    cltcmd = os.getenv('SQL_CLIENT')
    clt = subprocess.Popen(cltcmd, shell = True, stdin = subprocess.PIPE)
    clt.stdin.write('select 1;\n')
    clt.communicate()
    srv.communicate()

main()

Use the subprocess module to start processes with pipes. This seems to fix the lack of output on Windows.
Use the subprocess module to start processes with pipes.
This seems to fix the lack of output on Windows.

- import os, time
+ import subprocess, os, time
  
  def main():
      srvcmd = '%s --dbname "%s" --dbinit "include sql;"' % (os.getenv('MSERVER'),os.getenv('TSTDB'))
-     srv = os.popen(srvcmd, 'w')
+     srv = subprocess.Popen(srvcmd, shell = True, stdin = subprocess.PIPE)
      time.sleep(10)                      # give server time to start
      cltcmd = os.getenv('SQL_CLIENT')
-     clt = os.popen(cltcmd, 'w')
+     clt = subprocess.Popen(cltcmd, shell = True, stdin = subprocess.PIPE)
-     clt.write('select 1;\n')
+     clt.stdin.write('select 1;\n')
-     clt.close()
-     srv.close()
+     clt.communicate()
+     srv.communicate()
  
  main()
  
Use the subprocess module to start processes with pipes. This seems to fix the lack of output on Windows.
## Code Before:
import os, time

def main():
    srvcmd = '%s --dbname "%s" --dbinit "include sql;"' % (os.getenv('MSERVER'),os.getenv('TSTDB'))
    srv = os.popen(srvcmd, 'w')
    time.sleep(10)                      # give server time to start
    cltcmd = os.getenv('SQL_CLIENT')
    clt = os.popen(cltcmd, 'w')
    clt.write('select 1;\n')
    clt.close()
    srv.close()

main()

## Instruction:
Use the subprocess module to start processes with pipes. This seems to fix the lack of output on Windows.
## Code After:
import subprocess, os, time

def main():
    srvcmd = '%s --dbname "%s" --dbinit "include sql;"' % (os.getenv('MSERVER'),os.getenv('TSTDB'))
    srv = subprocess.Popen(srvcmd, shell = True, stdin = subprocess.PIPE)
    time.sleep(10)                      # give server time to start
    cltcmd = os.getenv('SQL_CLIENT')
    clt = subprocess.Popen(cltcmd, shell = True, stdin = subprocess.PIPE)
    clt.stdin.write('select 1;\n')
    clt.communicate()
    srv.communicate()

main()
