Pass and use original sys.argv to/with workers

This gets used e.g. by argparse for the "prog" part.

We could explicitly pass it through and/or set it on
config._parser.prog, but that is a bit tedious just for this use case,
and it looks like "simulating" the main prog here appears to not be that
bad of a hack after all.
This commit is contained in:
Daniel Hahler
2018-12-09 18:09:59 +01:00
parent 5ecbf25450
commit a70dace69c
4 changed files with 73 additions and 0 deletions

View File

@@ -261,6 +261,7 @@ if __name__ == "__channelexec__":
import py
config = remote_initconfig(option_dict, args)
config._parser.prog = os.path.basename(workerinput["mainargv"][0])
config.workerinput = workerinput
config.workeroutput = {}
# TODO: deprecated name, backward compatibility only. Remove it in future