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

Tasks - bin/updatedb.sh script - error to STDERR instead of STDOUT and more #5161

Closed
rcubetrac opened this issue Apr 16, 2013 · 6 comments
Closed
Milestone

Comments

@rcubetrac
Copy link

Reported by nuxwin on 16 Apr 2013 12:25 UTC as Trac ticket #1489043

Hello ;

It is possible to use STDERR to send any error from the updatedb.sh script instead of STDOUT? Since this script is for users that do no want use common installation (eg. using the roundcube installer), I think this script should follow standard POSIX rule for error handling.

eg, change any error output to

fwrite(STDERR, 'error message...');

instead of:

echo 'error message...';

That will prevent some integration scripts to do some things like this (here Perl):

...
        require iMSCP::Execute;
        iMSCP::Execute->import();

        my ($stdout, $stderr);
        $rs = execute(
            "$main::imscpConfig{'CMD_PHP'} $roudcubeDir/bin/updatedb.sh " .
            "--version=$fromVersion --dir=$roundcubeDir/SQL --package=roundcube",
            \$stdout, \$stderr
        );
        debug($stdout) if $stdout && ! $rs; # This because the updatedb.sh script use only STDOUT
        error($stdout) if $stdout && $rs; # This because the updatedb.sh script only use STDOUT
        error($stderr) if $stderr && $rs;
        return $rs if $rs;
...

Also, does it not possible to use .php instead of .sh as extension? Syntax Highlighters from some IDE (such as PHPStorm) use file extension to know the driver to use so...

Thanks you.
'''
Note:''' This kind of recommendation, can be also valable for any cli scripts you are providing.

Migrated-From: http://trac.roundcube.net/ticket/1489043

@rcubetrac
Copy link
Author

Comment by nuxwin on 16 Apr 2013 13:08 UTC

Re

I can eventually do the job if you are ok and then, send you a pull request? Waiting for any feedback :D

@rcubetrac
Copy link
Author

Comment by nuxwin on 16 Apr 2013 13:28 UTC

ok, See #68

@rcubetrac
Copy link
Author

Comment by @alecpl on 16 Apr 2013 16:59 UTC

The PR looks fine. Would you mind to update all scripts in the same way?

@rcubetrac
Copy link
Author

Comment by nuxwin on 16 Apr 2013 17:04 UTC

Sure :D

@rcubetrac
Copy link
Author

Comment by @alecpl on 26 Apr 2013 09:29 UTC

Fixed in f23ef1c.

@rcubetrac
Copy link
Author

Status changed by @alecpl on 26 Apr 2013 09:29 UTC

new => closed

@rcubetrac rcubetrac added this to the 0.9.1 milestone Mar 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant