mirror of
https://github.com/ytdl-org/youtube-dl
synced 2025-02-22 18:40:10 +09:00
avoid phantom windows in osascript
This commit is contained in:
parent
5d67355543
commit
43eef1dcd8
@ -557,7 +557,18 @@ class YoutubeDL(object):
|
|||||||
window_title = None
|
window_title = None
|
||||||
try:
|
try:
|
||||||
ttyname = os.ttyname(self._screen_file.fileno())
|
ttyname = os.ttyname(self._screen_file.fileno())
|
||||||
opts = ['-e', 'tell app "Terminal" to get custom title of item 1 of (every window whose tty is "%s")' % ttyname]
|
scpt = [
|
||||||
|
'tell app "Terminal"',
|
||||||
|
'repeat with win in (every window)',
|
||||||
|
'if tty of win is "%s" then' % ttyname,
|
||||||
|
'return custom title of win',
|
||||||
|
'end if',
|
||||||
|
'end repeat',
|
||||||
|
'end tell'
|
||||||
|
]
|
||||||
|
opts = []
|
||||||
|
for s in scpt:
|
||||||
|
opts += ['-e', s]
|
||||||
cmd = ([encodeFilename('osascript', True)]
|
cmd = ([encodeFilename('osascript', True)]
|
||||||
+ [encodeArgument(o) for o in opts])
|
+ [encodeArgument(o) for o in opts])
|
||||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
|
Loading…
Reference in New Issue
Block a user