1
0
mirror of https://github.com/ohwgiles/laminar.git synced 2024-10-27 20:34:20 +00:00

downstream link signal only within job

only add the private ANSI sequence to the output of laminarc
start/run commands used for adding a hyperlink to the frontend if
we are within a job execution (tested with __LAMINAR_SETENV_PIPE).
this makes parsing the output easier, which is likely to be more
common when laminarc is invoked externally
This commit is contained in:
Oliver Giles 2020-07-03 18:11:29 +12:00
parent d6be7f5079
commit 7f7e8d2455

View File

@ -74,9 +74,15 @@ static int setParams(int argc, char** argv, T& request) {
} }
static void printTriggerLink(const char* job, uint run) { static void printTriggerLink(const char* job, uint run) {
if(getenv("__LAMINAR_SETENV_PIPE")) {
// use a private ANSI CSI sequence to mark the JOB:NUM so the // use a private ANSI CSI sequence to mark the JOB:NUM so the
// frontend can recognise it and generate a hyperlink. // frontend can recognise it and generate a hyperlink.
printf("\033[{%s:%d\033\\\n", job, run); printf("\033[{%s:%d\033\\\n", job, run);
} else {
// not called from within a laminar job, let's not confuse
// scripts with ANSI sequences.
printf("%s:%d\n", job, run);
}
} }
static void usage(std::ostream& out) { static void usage(std::ostream& out) {