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
pull/137/head 0.9
Oliver Giles 4 years ago
parent d6be7f5079
commit 7f7e8d2455

@ -74,9 +74,15 @@ static int setParams(int argc, char** argv, T& request) {
}
static void printTriggerLink(const char* job, uint run) {
// use a private ANSI CSI sequence to mark the JOB:NUM so the
// frontend can recognise it and generate a hyperlink.
printf("\033[{%s:%d\033\\\n", job, run);
if(getenv("__LAMINAR_SETENV_PIPE")) {
// use a private ANSI CSI sequence to mark the JOB:NUM so the
// frontend can recognise it and generate a hyperlink.
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) {

Loading…
Cancel
Save