diff --git a/README.md b/README.md
index 70341829..40fa1679 100644
--- a/README.md
+++ b/README.md
@@ -190,6 +190,7 @@ the Wine prefix. Removing the option will revert to the previous behavior.
| Compat config string | Environment Variable | Description |
| :-------------------- | :----------------------------- | :----------- |
| | PROTON_LOG | Convenience method for dumping a useful debug log to `$HOME/steam-$APPID.log`. For more thorough logging, use `user_settings.py`. |
+| | PROTON_DUMP_DEBUG_COMMANDS | When running a game, Proton will write some useful debug scripts for that game into /tmp/proton_$USER/. |
| wined3d11 | PROTON_USE_WINED3D11 | Use OpenGL-based wined3d instead of Vulkan-based DXVK for d3d11. |
| nod3d11 | PROTON_NO_D3D11 | Disable d3d11.dll, for games which can fall back to and run better with d3d9. |
| noesync | PROTON_NO_ESYNC | Do not use eventfd-based in-process synchronization primitives. |
diff --git a/proton b/proton
index fd186600..8497a4f0 100755
--- a/proton
+++ b/proton
@@ -463,14 +463,16 @@ def dump_dbg_scripts():
os.chmod("/tmp/proton_run", 0755)
def run():
-# if "PROTON_DUMP_DEBUG_COMMAND" in os.environ: #for now, we are always dumping the debug scripts
- dump_dbg_scripts()
-# else: #see above
- if game_arch == ARCH_UNKNOWN:
- #probably a batch script or something, hopefully start.exe can handle it
- run_wine([wine_path, "start", "/unix"] + sys.argv[2:])
- else:
- run_wine([wine_path] + sys.argv[2:])
+ if "PROTON_DUMP_DEBUG_COMMANDS" in os.environ:
+ try:
+ dump_dbg_scripts()
+ except:
+ log("Unable to write debug scripts to /tmp/, probably someone else already owns them.")
+ if game_arch == ARCH_UNKNOWN:
+ #probably a batch script or something, hopefully start.exe can handle it
+ run_wine([wine_path, "start", "/unix"] + sys.argv[2:])
+ else:
+ run_wine([wine_path] + sys.argv[2:])
#determine mode
if sys.argv[1] == "run":