Skip to content

Commit e85f887

Browse files
Handle multiline command-line args
1 parent eed3447 commit e85f887

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎mprof.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import glob
22
import os
33
import os.path as osp
4+
import shlex
45
import sys
56
import re
67
import copy
@@ -175,8 +176,7 @@ def clean_action():
175176

176177
def get_cmd_line(args):
177178
"""Given a set or arguments, compute command-line."""
178-
blanks = set(' \t')
179-
args = [s if blanks.isdisjoint(s) else "'" + s + "'" for s in args]
179+
args = [shlex.quote(s).replace('\n', '\\n') for s in args]
180180
return ' '.join(args)
181181

182182
def find_first_process(name):

0 commit comments

Comments
 (0)