Skip to content

Improve the handling of stdout and stderr in daemon mode#219

Open
gulams wants to merge 1 commit intoopen-iscsi:masterfrom
gulams:targetcli-bug-2
Open

Improve the handling of stdout and stderr in daemon mode#219
gulams wants to merge 1 commit intoopen-iscsi:masterfrom
gulams:targetcli-bug-2

Conversation

@gulams
Copy link

@gulams gulams commented Jul 6, 2025

In daemon mode, the STDOUT and STDERR messages were aggregated into a single text file which was then relayed back to the caller. There was no differentiation between the STDOUT and STDERR which caused it to return 0 and not log any STDERR even in command failure case. Following is an example:

$ targetcli get global auto_use_daemon
auto_use_daemon=true

$ targetcli err; echo $?
Command not found err
0

The fix is to create separate temp files for stdout and stderr.

After the fix it returns error correctly (1):

$ targetcli get global auto_use_daemon
auto_use_daemon=true

$ targetcli err; echo $?
Command not found err
1

In daemon mode, the STDOUT and STDERR messages were aggregated into a
single text file which was then relayed back to the caller. There was no
differentiation between the STDOUT and STDERR which caused it to return
0 and not log any STDERR even in command failure case. Following is an
example:

$ targetcli get global auto_use_daemon
auto_use_daemon=true

$ targetcli err; echo $?
Command not found err
0

The fix is to create separate temp files for stdout and stderr.

After the fix it returns error correctly (1):

$ targetcli get global auto_use_daemon
auto_use_daemon=true

$ targetcli err; echo $?
Command not found err
1

Signed-off-by: Joshua Brown <joshua.f.brown@oracle.com>
Signed-off-by: Gulam Mohamed <gulam.mohamed@oracle.com>
@gulams
Copy link
Author

gulams commented Dec 2, 2025

Can anybody review this and let us know the comments?

@maurizio-lombardi
Copy link
Collaborator

Can anybody review this and let us know the comments?

Going to look at it

@maurizio-lombardi
Copy link
Collaborator

FYI, I didn't forget about it, I am investigating a failure that happens with the latest versions where in some cases I am unable to set the "auto_use_daemon" to true.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants