From: Eric S. Raymond Date: Mon, 13 Sep 2010 15:49:11 +0000 (+0000) Subject: Enable environment variable TMPDIR to set the log temporary directory. X-Git-Tag: 2.0~43 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=fcc0982757ef9c87939a9bff808e93064a28f688;p=super-star-trek.git Enable environment variable TMPDIR to set the log temporary directory. --- diff --git a/doc/sst.xml b/doc/sst.xml index fa2074f..bd7259b 100644 --- a/doc/sst.xml +++ b/doc/sst.xml @@ -66,19 +66,20 @@ mode (all features enabled). FILES -/usr/share/doc/sst/sst.doc +/usr/share/doc/sst/sst.doc Documentation file. -/usr/tmp/sst-input.log +$TMPDIR/sst-input.log -Where user input is saved to (send this with your bug reports). +Where user input is saved to (send this with your bug reports). +If TMPDIR is not set is defaults to /tmp. -emsave.trk +emsave.trk Save file produced by EMEXIT command. diff --git a/src/sst.py b/src/sst.py index 00f6df3..9eaf77d 100644 --- a/src/sst.py +++ b/src/sst.py @@ -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 + if "TMPDIR" in os.environ: + tmpdir = os.environ['TMPDIR'] + else: + tmpdir = "/tmp" 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)