Fix #48: Redirect compression execution logs for not having them overlapping PRINT
s
This commit is contained in:
parent
e23a0fc4c7
commit
c0db4eb437
16
main.cpp
16
main.cpp
@ -60,7 +60,8 @@ string CHANNELS_DIRECTORY = "channels/",
|
||||
YOUTUBE_OPERATIONAL_API_INSTANCE_URL = "http://localhost/YouTube-operational-API", // Can be "https://yt.lemnoslife.com" for instance.
|
||||
CAPTIONS_DIRECTORY = "captions/",
|
||||
DEBUG_DIRECTORY = "debug/",
|
||||
YOUTUBE_API_REQUESTS_DIRECTORY = "requests/";
|
||||
YOUTUBE_API_REQUESTS_DIRECTORY = "requests/",
|
||||
CURRENT_WORKING_DIRECTORY;
|
||||
bool USE_YT_LEMNOSLIFE_COM_NO_KEY_SERVICE = false;
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
@ -129,6 +130,13 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
char cwd[PATH_MAX];
|
||||
if (getcwd(cwd, sizeof(cwd)) != NULL) {
|
||||
CURRENT_WORKING_DIRECTORY = string(cwd) + "/";
|
||||
} else {
|
||||
MAIN_EXIT_WITH_ERROR("`getcwd()` error");
|
||||
}
|
||||
|
||||
MAIN_PRINT(channelsToTreat.size() << " channel(s) to treat")
|
||||
MAIN_PRINT(channelsAlreadyTreated.size() << " channel(s) already treated")
|
||||
|
||||
@ -194,13 +202,13 @@ void treatChannels(unsigned short threadId)
|
||||
// As I haven't found any well-known library that compress easily a directory, I have chosen to rely on `zip` cli.
|
||||
// We precise no `debug`ging, as otherwise the zipping operation doesn't work as expected.
|
||||
// As the zipping process isn't recursive, we can't just rely on `ls`, but we are obliged to use `find`.
|
||||
exec(threadId, "cd " + channelToTreatDirectory + " && find | zip ../" + channelToTreat + ".zip -@", false);
|
||||
exec(threadId, "cd " + channelToTreatDirectory + " && find | zip ../" + channelToTreat + ".zip -@");
|
||||
|
||||
PRINT("Compression finished, started deleting initial directory...")
|
||||
deleteDirectory(channelToTreatDirectory);
|
||||
PRINT("Deleting directory finished.")
|
||||
|
||||
PRINT(channelsCountThreads[threadId] << " comments were found for this channel.")
|
||||
PRINT(channelsCountThreads[threadId] << " channels were found for this channel.")
|
||||
}
|
||||
|
||||
channelsAlreadyTreatedAndToTreatMutex.unlock();
|
||||
@ -671,7 +679,7 @@ void exec(unsigned short threadId, string cmd, bool debug)
|
||||
toString << threadId;
|
||||
string initialCmd = cmd,
|
||||
threadIdStr = toString.str(),
|
||||
debugCommonFilePath = DEBUG_DIRECTORY + threadIdStr,
|
||||
debugCommonFilePath = CURRENT_WORKING_DIRECTORY + DEBUG_DIRECTORY + threadIdStr,
|
||||
debugOutFilePath = debugCommonFilePath + ".out",
|
||||
debugErrFilePath = debugCommonFilePath + ".err";
|
||||
cmd += " >> " + debugOutFilePath;
|
||||
|
Loading…
Reference in New Issue
Block a user