parallel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How are stdout output and stderr output ordered with respect to each oth


From: Peng Yu
Subject: How are stdout output and stderr output ordered with respect to each other?
Date: Mon, 12 Feb 2018 17:49:40 -0600

Hi,

The following example shows that the order of the stdout/err output is
not maintained. It seems that stdout always goes earlier than stderr.
Is it so?

Is there a way to make the order to be the same as if gnu parallel is
not called.

$ cat main.sh
#!/usr/bin/env bash
# vim: set noexpandtab tabstop=2:

set -v
function cmd {
echo "$2"
echo "$1" >&2
echo "$2"
}

export -f cmd
printf '%s\t%s\n' {1..4} | parallel --colsep $'\t' 'cmd {1} {2}'
$ ./main.sh
function cmd {
echo "$2"
echo "$1" >&2
echo "$2"
}

export -f cmd
printf '%s\t%s\n' {1..4} | parallel --colsep $'\t' 'cmd {1} {2}'
2
2
1
4
4
3

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]