@@ -145,6 +145,15 @@ def _write_cooldown() -> None:
145145 _last_write_time = time .monotonic ()
146146
147147
148+ def _pause_for_interactive () -> None :
149+ """Keep the console open when launched by double-click/right-click."""
150+ try :
151+ if sys .stdin is not None and sys .stdin .isatty ():
152+ input ("Press Enter to exit..." )
153+ except Exception :
154+ pass
155+
156+
148157def _ctrl_rec (flat : int ) -> int :
149158 """Return the CONTROL record offset for a flat using the discovered layout."""
150159 rec_base , rec_stride = vf_points .control_layout ()
@@ -739,7 +748,11 @@ def _prompt_float(label: str, current: float, lo: float, hi: float) -> float:
739748
740749def cmd_wizard (args , api : NvApi ) -> int :
741750 if not is_admin ():
751+ print ("=" * 60 , file = sys .stderr )
742752 print ("ERROR: wizard writes require administrator." , file = sys .stderr )
753+ print ("Please right-click this exe and choose" , file = sys .stderr )
754+ print (" 'Run as administrator'." , file = sys .stderr )
755+ print ("=" * 60 , file = sys .stderr )
743756 return 2
744757 if not _ensure_supported_auto (api , args ):
745758 print ("Auto-check did not fully pass." , file = sys .stderr )
@@ -1026,8 +1039,15 @@ def main(argv=None) -> int:
10261039 api = _api (args .gpu )
10271040 except Exception as e :
10281041 print (f"Failed to init NvAPI: { e } " , file = sys .stderr )
1042+ if getattr (args , "cmd" , None ) is None :
1043+ _pause_for_interactive ()
10291044 return 2
1030- return args .func (args , api )
1045+ rc = args .func (args , api )
1046+ # When launched by double-click / right-click with no subcommand, keep the
1047+ # console open on failure so the user can read the error.
1048+ if getattr (args , "cmd" , None ) is None and rc != 0 :
1049+ _pause_for_interactive ()
1050+ return rc
10311051
10321052
10331053if __name__ == "__main__" :
0 commit comments