Skip to content

Commit aac9d87

Browse files
authored
Merge pull request #1070 from davep/monkey-patch-argv
Change the way that `textual run` does the argv monkey-patch
2 parents 2e98c21 + c391681 commit aac9d87

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/textual/_import_app.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import os
4+
import sys
45
import runpy
56
import shlex
67
from pathlib import Path
@@ -30,7 +31,6 @@ def import_app(import_name: str) -> App:
3031

3132
import inspect
3233
import importlib
33-
import sys
3434

3535
from textual.app import App, WINDOWS
3636

@@ -45,8 +45,7 @@ def import_app(import_name: str) -> App:
4545
except Exception as error:
4646
raise AppFail(str(error))
4747

48-
if "sys" in global_vars:
49-
global_vars["sys"].argv = [path, *argv]
48+
sys.argv[:] = [path, *argv]
5049

5150
if name:
5251
# User has given a name, use that

0 commit comments

Comments
 (0)