Commit dd2407d7 authored by Nikola Hardi's avatar Nikola Hardi
Browse files

Use the rewriter return code in the Mkdir method

parent 296f3377
Pipeline #1343890 passed with stage
in 4 minutes and 28 seconds
......@@ -438,14 +438,14 @@ Bool_t TJAlien::Cd(const char* lfn, Bool_t verbose)
//______________________________________________________________________________
Int_t TJAlien::Mkdir(const char* ldn, Option_t* option, Bool_t verbose)
{
// returns exitcode, what means:
// 0 - if success
// not 0 with error message - if sth went wrong
// returns exitcode (notice the strainge convention, it is required for backwards compatibility!):
// 1 - if success
// 0 - if something went wrong
if (ldn == nullptr || std::string(ldn).find_first_not_of(' ') == std::string::npos)
{
Error("Mkdir", "Command requires an argument");
return -1;
return 0;
}
TString cmdline("mkdir");
......@@ -469,21 +469,24 @@ Int_t TJAlien::Mkdir(const char* ldn, Option_t* option, Bool_t verbose)
TJAlienResult * jalienresult = (TJAlienResult*) result;
TObjString *errorMessage = 0;
Int_t exitcode = GetExitCode(jalienresult, errorMessage);
if (exitcode != 0)
if (exitcode != 0 && gDebug > 1)
{
if (gDebug > 1) Error("Mkdir", "Mkdir command failed with error message \"%s\"", errorMessage->GetString().Data());
delete result;
return exitcode;
Error("Mkdir", "Mkdir command failed with error message \"%s\"", errorMessage->GetString().Data());
}
if (gDebug > 1) Info("Mkdir", "Mkdir command successful, created directory \"%s\"", ldn);
else if(exitcode == 0 && gDebug > 1)
{
Info("Mkdir", "Mkdir command successful, created directory \"%s\"", ldn);
}
const char *retval = result->GetKey(0, "__result__");
delete result;
return exitcode;
return atoi(retval);
}
Error("Mkdir", "Cannot create directory %s", ldn);
if (!verbose) Stdout();
return 1;
return 0;
}
//______________________________________________________________________________
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment