Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate output in non-interactive mode #919

Closed
prudloff-insite opened this issue Dec 30, 2019 · 1 comment · Fixed by #1152
Closed

Duplicate output in non-interactive mode #919

prudloff-insite opened this issue Dec 30, 2019 · 1 comment · Fixed by #1152

Comments

@prudloff-insite
Copy link
Contributor

Steps to reproduce

I am using an Ssh task with a global stopOnFail, with Robo 1.4.11 called in a non-interactive terminal.

Here is a basic example that reproduces the issue:

  public function test() {
    $this->stopOnFail();

    $sshTask = $this->taskSshExec();
    $sshTask
      ->interactive(FALSE)
      ->exec('echo "hello"')
      ->exec('invalid_cmd')
      ->run();
  }

Expected behavior

The "hello" output should only be printed once.

Actual behavior

The output is printed three times:

 echo "hello" &&
 invalid_cmd'
hello
bash: invalid_cmd: command not found
 [Remote\Ssh]  hello
  Time 0.367s
 [Remote\Ssh]  Exit code 127  Time 0.367s
 [notice] Stopping on fail. Exiting....
 [error]  Exit Code: 127 
 [error]    in task Robo\Task\Remote\Ssh 

  hello

I think one duplicate is caused by the global stopOnFail and another one is caused by the SSH class.

This does not happen in interactive mode.

System Configuration

PHP 7.2.24 on Linux Mint 19.3.

@prudloff-insite
Copy link
Contributor Author

We still have this very verbose output with Robo 4.
I have traced to the following calls:

  • Process::readPipes(): seems legit to print it here if isPrinted is true
  • Result::printError(): the logic here seems to be to only print if it is not already printed elsewhere
    It does not work with SSH tasks because Ssh does not implement PrintedInterface
  • ResultWriter::writeErrorMessage(): seems legit to write the exception message here
    In our case it repeats the command output, but there are cases where it could be different.
    It might make a little more sense to display the command error output here, but it seems the TaskExitException does not have this information.

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 a pull request may close this issue.

1 participant