We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 302784d commit 0647653Copy full SHA for 0647653
3 files changed
src/main.rs
@@ -43,6 +43,9 @@ fn main() {
43
.takes_value(true)
44
.help("run library module as script"),
45
)
46
+ .arg(Arg::from_usage("[pyargs] 'args for python'")
47
+ .multiple(true)
48
+ )
49
.get_matches();
50
51
// Construct vm:
tests/snippets/sysmod_argv.py
@@ -1,4 +1,4 @@
1
import sys
2
3
-print(sys.argv[1])
4
-
+print(sys.argv)
+assert sys.argv[0].endswith('.py')
vm/src/sysmodule.rs
@@ -7,7 +7,8 @@ use super::vm::VirtualMachine;
7
*/
8
9
fn argv(ctx: &PyContext) -> PyObjectRef {
10
- let argv: Vec<PyObjectRef> = env::args().map(|x| ctx.new_str(x)).collect();
+ let mut argv: Vec<PyObjectRef> = env::args().map(|x| ctx.new_str(x)).collect();
11
+ argv.remove(0);
12
ctx.new_list(argv)
13
}
14
0 commit comments