guider icon indicating copy to clipboard operation
guider copied to clipboard

Support the configuration of a shell environment before tracing a passed command

Open elfring opened this issue 3 years ago • 10 comments

The tool “guider” supports tracing (or profiling) for passed commands. These commands are directly executed so far. But this execution configuration should be adjusted for some use cases.

We are used to functionality which is provided by some command-line interpreters. We would occasionally like to redirect data streams before a specified command will be executed. How should the corresponding shell be constructed (without extra tracing) so that the desired data processing will be continued as expected? :thinking:

elfring avatar Oct 04 '21 08:10 elfring

could you share more detailed examples? As I understand, You wanna control stdout stream for target task created by guider. isn't it?

iipeace avatar Oct 04 '21 10:10 iipeace

I would like to specify special files for the standard data streams of my test programs so that the output will be separated from data by your analysis tool for further software test runs. I hope that I can avoid to construct additional shell scripts for data redirection purposes.

elfring avatar Oct 04 '21 11:10 elfring

Do you want to redirect stdout of specific program to specific file such a below example?

# guider btrace "ls -lha > ./output"

iipeace avatar Oct 04 '21 12:10 iipeace

Yes (in principle)

Data redirections can be extended on demand, can't they?

elfring avatar Oct 04 '21 12:10 elfring

Yes, there was no option about it. I implemented new options about it and you can test them using such below examples.

# ./guider.py btrace "ls" -q stdout:"./stdout"
# ./guider.py btrace "ls" -q stderr:"./stderr"

They will affect standard I/O of all child tasks.

iipeace avatar Oct 04 '21 13:10 iipeace

Yes, there was no option about it.

Thanks for another constructive feedback.

# ./guider.py btrace "ls" -q stdout:"./stdout"

I imagined an other solution approach. I hope that more data streams can be generally supported (like we are used to by the means of interactive shells).

elfring avatar Oct 04 '21 14:10 elfring

I hope that more data streams can be generally supported (like we are used to by the means of interactive shells).

How do you specify other data streams except for stdin, stdout, stderr? could you share more detailed examples? I can't understand ;)

iipeace avatar Oct 04 '21 14:10 iipeace

How do you specify other data streams except for stdin, stdout, stderr?

Do you find the article “Linux Fundamentals – I/O, Standard Streams, and Redirection.” by Steven Vona helpful in this area?

I can't understand

Would you like to take another look in a manual from a popular shell?

elfring avatar Oct 04 '21 14:10 elfring

I got it. You wanna use pipe from stdout or stderr of target task to stdin of other process? Covering such all redirections is not small job ;)

How about making a new shell script for them?

iipeace avatar Oct 04 '21 14:10 iipeace

Can a “shell” be chosen to resolve all configured redirections (similar to the way as it would usually happen in interactive mode)?

How about making a new shell script for them?

The evaluation of additional shell scripts might influence tracing approaches in undesirable ways, doesn't it?

elfring avatar Oct 04 '21 14:10 elfring