From: vsr Date: Thu, 28 Oct 2010 08:07:18 +0000 (+0000) Subject: Fix problem on Debian 6 with redirecting output to /dev/null X-Git-Tag: V5_1_5~13 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cfed33e4cdcb16b4412f89a18c018a87f2513414;p=tools%2Finstall.git Fix problem on Debian 6 with redirecting output to /dev/null --- diff --git a/bin/SALOME_InstallWizard b/bin/SALOME_InstallWizard index 810b044..30b1b41 100755 Binary files a/bin/SALOME_InstallWizard and b/bin/SALOME_InstallWizard differ diff --git a/src/SALOME_InstallWizard.cxx b/src/SALOME_InstallWizard.cxx index 278ba62..61a92c9 100644 --- a/src/SALOME_InstallWizard.cxx +++ b/src/SALOME_InstallWizard.cxx @@ -61,6 +61,9 @@ QString tmpDirName() { return QString( "/INSTALLWORK" ) + QString::number( getpid() ); } #define TEMPDIRNAME tmpDirName() +// uncomment next line to redirect all shell output (usually for errors) to /dev/null device +// #define USE_DEV_NULL + // ================================================================ /*! * Script @@ -313,8 +316,15 @@ static bool makeDir( const QString& theDir, QString& theCreated ) if ( !fi.exists() ) { // VSR: Create directory and set permissions to allow other users to remove it Script script; - script << "mkdir" << QUOTE( fi.absFilePath() ) << ">& /dev/null" << "&&"; - script << "chmod 777" << QUOTE( fi.absFilePath() ) << ">& /dev/null"; + script << "mkdir" << QUOTE( fi.absFilePath() ); +#ifdef USE_DEV_NULL + script << ">& /dev/null"; +#endif + script << "&&"; + script << "chmod 777" << QUOTE( fi.absFilePath() ); +#ifdef USE_DEV_NULL + script << ">& /dev/null"; +#endif ___MESSAGE___( "script = " << script.script().latin1() ); if ( system( script.script().latin1() ) ) return false; @@ -328,7 +338,10 @@ static bool makeDir( const QString& theDir, QString& theCreated ) if ( !QFileInfo( aDir ).exists() ) { // VSR: Create directory, other users should NOT have possibility to remove it!!! Script script; - script << "mkdir" << QUOTE( aDir ) << ">& /dev/null"; + script << "mkdir" << QUOTE( aDir ); +#ifdef USE_DEV_NULL + script << ">& /dev/null"; +#endif ___MESSAGE___( "script = " << script.script().latin1() ); if ( system( script.script().latin1() ) ) return false; @@ -647,7 +660,10 @@ SALOME_InstallWizard::~SALOME_InstallWizard() int PID = (int)shellProcess->processIdentifier(); if ( PID > 0 ) { Script script; - script << "kill -9" << QString::number( PID ) << ">& /dev/null"; + script << "kill -9" << QString::number( PID ); +#ifdef USE_DEV_NULL + script << ">& /dev/null"; +#endif ___MESSAGE___( "script: " << script.script().latin1() ); if ( system( script.script().latin1() ) ) { // error @@ -2429,7 +2445,9 @@ void SALOME_InstallWizard::onFinishButton() script << (*it).script() << "execute"; script << QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() ); script << QUOTE( QFileInfo( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME ).absFilePath() ); +#ifdef USE_DEV_NULL script << ">& /dev/null"; +#endif ___MESSAGE___( "script: " << script.script().latin1() ); if ( (*it).script().isEmpty() || system( script.script().latin1() ) ) { QMessageBox::warning( this, @@ -2544,7 +2562,9 @@ void SALOME_InstallWizard::clean(bool rmDir) script << "cd" << QUOTE( rd.filePath( "config_files" ) ) << ";"; script << "remove_tmp.sh" << QUOTE( tempFolder->text().stripWhiteSpace() + TEMPDIRNAME ); script << QUOTE( getAllProducts( productsMap ) ); +#ifdef USE_DEV_NULL script << ">& /dev/null"; +#endif ___MESSAGE___( "script = " << script.script().latin1() ); if ( system( script.script().latin1() ) ) { // error @@ -2554,7 +2574,9 @@ void SALOME_InstallWizard::clean(bool rmDir) if ( rmDir && !tmpCreated.isNull() ) { script.clear(); script << "rm -rf" << QUOTE( tmpCreated ); +#ifdef USE_DEV_NULL script << ">& /dev/null"; +#endif if ( system( script.script().latin1() ) ) { // error } @@ -2696,7 +2718,9 @@ void SALOME_InstallWizard::pageChanged( const QString & mytitle) script << (*it).script() << "check_enabled"; script << QUOTE( QFileInfo( QDir::cleanDirPath( targetFolder->text().stripWhiteSpace() ) ).absFilePath() ); script << QUOTE( QFileInfo( QDir::cleanDirPath( tempFolder->text().stripWhiteSpace() ) + TEMPDIRNAME ).absFilePath() ); +#ifdef USE_DEV_NULL script << ">& /dev/null"; +#endif ___MESSAGE___( "script: " << script.script().latin1() ); (*it).button()->setEnabled( !(*it).script().isEmpty() && !system( script.script().latin1() ) ); }