Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
pygolang
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Levin Zimmermann
pygolang
Commits
840a5eae
Commit
840a5eae
authored
Nov 27, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gpython: '-' means gpython should read program file from stdin
Reported by
@jerome
here:
nexedi/slapos!862 (comment 121738)
parent
8564dfdd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
gpython/__init__.py
gpython/__init__.py
+2
-2
gpython/gpython_test.py
gpython/gpython_test.py
+4
-0
No files found.
gpython/__init__.py
View file @
840a5eae
...
...
@@ -157,7 +157,7 @@ def pymain(argv, init=None):
reexec_argv
+=
argv
if
run
is
None
:
# file
if
len
(
argv
)
>
0
:
if
len
(
argv
)
>
0
and
argv
[
0
]
!=
'-'
:
sys
.
argv
=
argv
filepath
=
argv
[
0
]
...
...
@@ -173,7 +173,7 @@ def pymain(argv, init=None):
# interactive console
else
:
sys
.
argv
=
[
''
]
sys
.
argv
=
[
''
]
if
len
(
argv
)
==
0
else
argv
# e.g. ['-']
sys
.
path
.
insert
(
0
,
''
)
# cwd
def
run
():
...
...
gpython/gpython_test.py
View file @
840a5eae
...
...
@@ -163,6 +163,10 @@ def test_pymain():
# interactive
_
=
pyout
([],
stdin
=
b'import hello
\
n
'
,
cwd
=
testdata
)
assert
_
==
b"hello
\
n
world
\
n
['']
\
n
"
_
=
pyout
([
'-'
],
stdin
=
b'import hello
\
n
'
,
cwd
=
testdata
)
assert
_
==
b"hello
\
n
world
\
n
['-']
\
n
"
_
=
pyout
([
'-'
,
'zzz'
],
stdin
=
b'import hello
\
n
'
,
cwd
=
testdata
)
assert
_
==
b"hello
\
n
world
\
n
['-', 'zzz']
\
n
"
# -c <command>
_
=
pyout
([
'-c'
,
'import hello'
,
'abc'
,
'def'
],
cwd
=
testdata
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment