Skip to content

configure scripts cannot use pipe characters inside run() commands #223

Description

@gerhardqux

The run() implementation fails on pipe characters as of:
a37894a

[root@(none) /]# ./test
1: 0 qux
+ echo qux | sort | sort
sort: fflush failed: standard output: Broken pipe
sort: write error
[root@(none) /]# cat test
#!/usr/bin/env python

import commands
import sys

def run(cmd):
    sys.stderr.write('+ ' + cmd + '\n')
    status, output = commands.getstatusoutput(cmd + ' </dev/null')
    sys.stderr.write(output + '\n')
    if status != 0:
        sys.stderr.write("Command '%s' failed\n" % cmd)
        sys.stderr.write("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n")
        sys.stderr.write("!!! Configure script exited prematurely !!!\n")
        sys.stderr.write("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n")
        sys.exit(status)

testcmd='echo qux | sort | sort'

status, output = commands.getstatusoutput(testcmd)
sys.stderr.write("1: %d %s\n" % (status, output))

run(testcmd)

#run('echo bar | sort | sort')
#run('ls /sys/block/ | grep "^sd" >/after')

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions