Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle multiline command-line args #363

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stepan-anokhin
Copy link

@stepan-anokhin stepan-anokhin commented Sep 17, 2022

Fix the problem from #210

The problem occurs when mprof run <command> has multi-line arguments:

For example:

read -r -d '' MESSAGE << EOM            
  hello
  world
EOM

mprof run echo "$MESSAGE"
mprof plot
Using last profile data.
Traceback (most recent call last):
  File "/home/stepan/mprof-example/venv/bin/mprof", line 8, in <module>
    sys.exit(main())
  File "/home/stepan/mprof-example/venv/lib/python3.8/site-packages/mprof.py", line 905, in main
    actions[get_action()]()
  File "/home/stepan/mprof-example/venv/lib/python3.8/site-packages/mprof.py", line 819, in plot_action
    mprofile = plotter(filename, index=n, timestamps=timestamps, options=args)
  File "/home/stepan/mprof-example/venv/lib/python3.8/site-packages/mprof.py", line 409, in plot_file
    mprofile = read_mprofile_file(filename)
  File "/home/stepan/mprof-example/venv/lib/python3.8/site-packages/mprof.py", line 364, in read_mprofile_file
    field, value = l.split(' ', 1)
ValueError: not enough values to unpack (expected 2, got 1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant