From 7f7e8d24550a46c390a22934f7ddc020928fd829 Mon Sep 17 00:00:00 2001 From: Oliver Giles Date: Fri, 3 Jul 2020 18:11:29 +1200 Subject: [PATCH] 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 --- src/client.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/client.cpp b/src/client.cpp index 2ee46c6..fde382e 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -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) {