Enable environment variable TMPDIR to set the log temporary directory.
[super-star-trek.git] / src / sst.py
index 00f6df3dfa65ec08b449a6fa8c933283ebca08ca..9eaf77dc990a98fab700f7eb927dc613f1298a3c 100644 (file)
@@ -6197,8 +6197,12 @@ if __name__ == '__main__':
                 sys.stderr.write("usage: sst [-t] [-x] [startcommand...].\n")
                 raise SystemExit, 1
         # where to save the input in case of bugs
                 sys.stderr.write("usage: sst [-t] [-x] [startcommand...].\n")
                 raise SystemExit, 1
         # where to save the input in case of bugs
+        if "TMPDIR" in os.environ:
+            tmpdir = os.environ['TMPDIR']
+        else:
+            tmpdir = "/tmp"
         try:
         try:
-            logfp = open("/tmp/sst-input.log", "w")
+            logfp = open(os.path.join(tmpdir, "sst-input.log"), "w")
         except IOError:
             sys.stderr.write("sst: warning, can't open logfile\n")
             sys.exit(1)
         except IOError:
             sys.stderr.write("sst: warning, can't open logfile\n")
             sys.exit(1)