Remove sh -euc from output

This commit is contained in:
jpic 2021-11-12 02:44:46 +01:00
parent 5a38535cdb
commit 217777f60e
2 changed files with 12 additions and 9 deletions

View File

@ -52,9 +52,6 @@ class Subprocess:
write=None, write=None,
flush=None, flush=None,
): ):
if len(args) == 1 and ' ' in args[0]:
args = ['sh', '-euc', args[0]]
self.args = args self.args = args
self.quiet = quiet if quiet is not None else False self.quiet = quiet if quiet is not None else False
self.prefix = prefix self.prefix = prefix
@ -79,7 +76,7 @@ class Subprocess:
self.output( self.output(
self.colors.bgray.encode() self.colors.bgray.encode()
+ b'+ ' + b'+ '
+ shlex.join([ + ' '.join([
arg.replace('\n', '\\n') arg.replace('\n', '\\n')
for arg in self.args for arg in self.args
]).encode() ]).encode()
@ -93,13 +90,19 @@ class Subprocess:
self.exit_future = asyncio.Future(loop=loop) self.exit_future = asyncio.Future(loop=loop)
if len(self.args) == 1 and ' ' in self.args[0]:
args = ['sh', '-euc', self.args[0]]
else:
args = self.args
# Create the subprocess controlled by DateProtocol; # Create the subprocess controlled by DateProtocol;
# redirect the standard output into a pipe. # redirect the standard output into a pipe.
self.transport, self.protocol = await loop.subprocess_exec( self.transport, self.protocol = await loop.subprocess_exec(
lambda: SubprocessProtocol(self), lambda: SubprocessProtocol(self),
*self.args, *args,
stdin=None, stdin=None,
) )
self.started = True self.started = True
async def wait(self, *args, **kwargs): async def wait(self, *args, **kwargs):

View File

@ -74,7 +74,7 @@ async def test_prefix():
+ Proc.colors.reset.encode() + Proc.colors.reset.encode()
+ b'| ' + b'| '
+ Proc.colors.bgray.encode() + Proc.colors.bgray.encode()
+ b'+ sh -euc \'echo hi\'' + b'+ echo hi'
+ Proc.colors.reset.encode() + Proc.colors.reset.encode()
+ b'\n' + b'\n'
), ),
@ -92,7 +92,7 @@ async def test_prefix():
+ Proc.colors.reset.encode() + Proc.colors.reset.encode()
+ b'| ' + b'| '
+ Proc.colors.bgray.encode() + Proc.colors.bgray.encode()
+ b'+ sh -euc \'echo hi\'' + b'+ echo hi'
+ Proc.colors.reset.encode() + Proc.colors.reset.encode()
+ b'\n' + b'\n'
), ),
@ -112,7 +112,7 @@ async def test_prefix():
+ Proc.colors.reset.encode() + Proc.colors.reset.encode()
+ b'| ' + b'| '
+ Proc.colors.bgray.encode() + Proc.colors.bgray.encode()
+ b'+ sh -euc \'echo hi\'' + b'+ echo hi'
+ Proc.colors.reset.encode() + Proc.colors.reset.encode()
+ b'\n' + b'\n'
), ),
@ -143,7 +143,7 @@ async def test_prefix_multiline():
+ Proc.colors.reset.encode() + Proc.colors.reset.encode()
+ b'| ' + b'| '
+ Proc.colors.bgray.encode() + Proc.colors.bgray.encode()
+ b'+ sh -euc \'echo -e "a\\nb"\'' + b'+ echo -e "a\\nb"'
+ Proc.colors.reset.encode() + Proc.colors.reset.encode()
+ b'\n' + b'\n'
), ),