Skip to content

Commit

Permalink
downstream link signal only within job
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ohwgiles committed Jul 3, 2020
1 parent d6be7f5 commit 7f7e8d2
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 7f7e8d2

Please sign in to comment.