kkpyutil 1.33.2__tar.gz → 1.33.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: kkpyutil
3
- Version: 1.33.2
3
+ Version: 1.33.3
4
4
  Summary: Building blocks for sysadmin and DevOps
5
5
  Home-page: https://github.com/kakyoism/kkpyutil/
6
6
  License: MIT
@@ -588,15 +588,21 @@ def alert(content, title='Debug', action='Close'):
588
588
  - on Windows, mshta msgbox does not support custom button text
589
589
  - so "action" is ignored on windows
590
590
  - multiline message uses \n as line separator
591
+ - mshta (ms html application host) tend to open vbs using text editor; so we use dedicated vbscript cli instead
591
592
  """
592
593
  if PLATFORM == 'Windows':
593
594
  # Escape double quotes inside content and title for VBScript
594
595
  # vbs uses its own line-end
595
596
  content = content.replace('\n', '" & vbCrLf & "').replace('"', '""')
596
597
  title = title.replace('"', '""')
597
- vbs = f'msgbox ""{content}"", 0, ""{title}""'
598
- cmd = ['mshta', f'vbscript:Execute("{vbs}")']
599
- os.system(' '.join(cmd))
598
+ # Construct the VBScript command for the message box
599
+ vbs_content = f'MsgBox "{content}", 0, "{title}"'
600
+ vbs = osp.join(get_platform_tmp_dir(), 'msg.vbs')
601
+ save_text(vbs, vbs_content)
602
+ cmd = ['cscript', '//Nologo', vbs]
603
+ subprocess.run(cmd, shell=True)
604
+ # Clean up the temporary file
605
+ os.remove(vbs)
600
606
  return cmd
601
607
  if PLATFORM == 'Darwin':
602
608
  cmd = ['osascript', '-e', f'display alert "{title}" message "{content}"']
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "kkpyutil"
3
- version = "1.33.2"
3
+ version = "1.33.3"
4
4
  description = "Building blocks for sysadmin and DevOps"
5
5
  authors = ["Beinan Li <li.beinan@gmail.com>"]
6
6
  maintainers = ["Beinan Li <li.beinan@gmail.com>"]
File without changes
File without changes