Waiting for async console (message queue) output after invoking a command [closed]
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
I have to work with a command (lets call it update
) which somehow prints its output asynchronously to the terminal (mq_timedsend
). The output is not recognized as the commands output and therefore the stdout
of the command is not usable (piping like update| grep -m 1 "$s"
does not work). Unfortunately, I have to life with this.
Invoking the command sooner or later will print $s
or $f
as the creators were apparently also not aware of exit codes. I need to be able to parse after $s
and $f
and set the exit code manually.
I'm still not very versioned with bash
and all its possibilities. How could a script or even a single chained command which will execute the update
command and will wait until the specific text ($s
or $f
) appears in the console look like? Is this even possible?
bash output exit-code async
closed as unclear what you're asking by andcoz, schily, Isaac, msp9011, maulinglawns Aug 22 at 10:16
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
 |Â
show 1 more comment
up vote
1
down vote
favorite
I have to work with a command (lets call it update
) which somehow prints its output asynchronously to the terminal (mq_timedsend
). The output is not recognized as the commands output and therefore the stdout
of the command is not usable (piping like update| grep -m 1 "$s"
does not work). Unfortunately, I have to life with this.
Invoking the command sooner or later will print $s
or $f
as the creators were apparently also not aware of exit codes. I need to be able to parse after $s
and $f
and set the exit code manually.
I'm still not very versioned with bash
and all its possibilities. How could a script or even a single chained command which will execute the update
command and will wait until the specific text ($s
or $f
) appears in the console look like? Is this even possible?
bash output exit-code async
closed as unclear what you're asking by andcoz, schily, Isaac, msp9011, maulinglawns Aug 22 at 10:16
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
Are you searching for literally$s
inupdate
output? What happens if you tryupdate | grep -m 1 -F '$s'
?
â andcoz
Aug 21 at 12:16
Nothing, as the commandupdate
does not produce a direct output. It most possibly starts another background process which finally prints to the console.
â Herr Derb
Aug 21 at 12:23
Perhapsupdate
is usingSTDERR
, tryupdate 2>&1 | grep -m 1 -F '$s'
â andcoz
Aug 21 at 14:04
no I'm afraid not.update &> log.txt
results in an empty file while text is getting printed to the console, after the console was ready to take input again.
â Herr Derb
Aug 21 at 15:28
1
You should find out what processesupdate
creates and what file descriptors it writes to. Try with e.g.strace
or similar.
â RudiC
Aug 21 at 22:13
 |Â
show 1 more comment
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have to work with a command (lets call it update
) which somehow prints its output asynchronously to the terminal (mq_timedsend
). The output is not recognized as the commands output and therefore the stdout
of the command is not usable (piping like update| grep -m 1 "$s"
does not work). Unfortunately, I have to life with this.
Invoking the command sooner or later will print $s
or $f
as the creators were apparently also not aware of exit codes. I need to be able to parse after $s
and $f
and set the exit code manually.
I'm still not very versioned with bash
and all its possibilities. How could a script or even a single chained command which will execute the update
command and will wait until the specific text ($s
or $f
) appears in the console look like? Is this even possible?
bash output exit-code async
I have to work with a command (lets call it update
) which somehow prints its output asynchronously to the terminal (mq_timedsend
). The output is not recognized as the commands output and therefore the stdout
of the command is not usable (piping like update| grep -m 1 "$s"
does not work). Unfortunately, I have to life with this.
Invoking the command sooner or later will print $s
or $f
as the creators were apparently also not aware of exit codes. I need to be able to parse after $s
and $f
and set the exit code manually.
I'm still not very versioned with bash
and all its possibilities. How could a script or even a single chained command which will execute the update
command and will wait until the specific text ($s
or $f
) appears in the console look like? Is this even possible?
bash output exit-code async
bash output exit-code async
edited Aug 22 at 8:06
asked Aug 21 at 12:06
Herr Derb
1062
1062
closed as unclear what you're asking by andcoz, schily, Isaac, msp9011, maulinglawns Aug 22 at 10:16
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
closed as unclear what you're asking by andcoz, schily, Isaac, msp9011, maulinglawns Aug 22 at 10:16
Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, itâÂÂs hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.
Are you searching for literally$s
inupdate
output? What happens if you tryupdate | grep -m 1 -F '$s'
?
â andcoz
Aug 21 at 12:16
Nothing, as the commandupdate
does not produce a direct output. It most possibly starts another background process which finally prints to the console.
â Herr Derb
Aug 21 at 12:23
Perhapsupdate
is usingSTDERR
, tryupdate 2>&1 | grep -m 1 -F '$s'
â andcoz
Aug 21 at 14:04
no I'm afraid not.update &> log.txt
results in an empty file while text is getting printed to the console, after the console was ready to take input again.
â Herr Derb
Aug 21 at 15:28
1
You should find out what processesupdate
creates and what file descriptors it writes to. Try with e.g.strace
or similar.
â RudiC
Aug 21 at 22:13
 |Â
show 1 more comment
Are you searching for literally$s
inupdate
output? What happens if you tryupdate | grep -m 1 -F '$s'
?
â andcoz
Aug 21 at 12:16
Nothing, as the commandupdate
does not produce a direct output. It most possibly starts another background process which finally prints to the console.
â Herr Derb
Aug 21 at 12:23
Perhapsupdate
is usingSTDERR
, tryupdate 2>&1 | grep -m 1 -F '$s'
â andcoz
Aug 21 at 14:04
no I'm afraid not.update &> log.txt
results in an empty file while text is getting printed to the console, after the console was ready to take input again.
â Herr Derb
Aug 21 at 15:28
1
You should find out what processesupdate
creates and what file descriptors it writes to. Try with e.g.strace
or similar.
â RudiC
Aug 21 at 22:13
Are you searching for literally
$s
in update
output? What happens if you try update | grep -m 1 -F '$s'
?â andcoz
Aug 21 at 12:16
Are you searching for literally
$s
in update
output? What happens if you try update | grep -m 1 -F '$s'
?â andcoz
Aug 21 at 12:16
Nothing, as the command
update
does not produce a direct output. It most possibly starts another background process which finally prints to the console.â Herr Derb
Aug 21 at 12:23
Nothing, as the command
update
does not produce a direct output. It most possibly starts another background process which finally prints to the console.â Herr Derb
Aug 21 at 12:23
Perhaps
update
is using STDERR
, try update 2>&1 | grep -m 1 -F '$s'
â andcoz
Aug 21 at 14:04
Perhaps
update
is using STDERR
, try update 2>&1 | grep -m 1 -F '$s'
â andcoz
Aug 21 at 14:04
no I'm afraid not.
update &> log.txt
results in an empty file while text is getting printed to the console, after the console was ready to take input again.â Herr Derb
Aug 21 at 15:28
no I'm afraid not.
update &> log.txt
results in an empty file while text is getting printed to the console, after the console was ready to take input again.â Herr Derb
Aug 21 at 15:28
1
1
You should find out what processes
update
creates and what file descriptors it writes to. Try with e.g. strace
or similar.â RudiC
Aug 21 at 22:13
You should find out what processes
update
creates and what file descriptors it writes to. Try with e.g. strace
or similar.â RudiC
Aug 21 at 22:13
 |Â
show 1 more comment
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Are you searching for literally
$s
inupdate
output? What happens if you tryupdate | grep -m 1 -F '$s'
?â andcoz
Aug 21 at 12:16
Nothing, as the command
update
does not produce a direct output. It most possibly starts another background process which finally prints to the console.â Herr Derb
Aug 21 at 12:23
Perhaps
update
is usingSTDERR
, tryupdate 2>&1 | grep -m 1 -F '$s'
â andcoz
Aug 21 at 14:04
no I'm afraid not.
update &> log.txt
results in an empty file while text is getting printed to the console, after the console was ready to take input again.â Herr Derb
Aug 21 at 15:28
1
You should find out what processes
update
creates and what file descriptors it writes to. Try with e.g.strace
or similar.â RudiC
Aug 21 at 22:13