Skip to content
This repository has been archived by the owner on Oct 16, 2021. It is now read-only.

Commit

Permalink
[z/OS] Skip character conversion for ASCII streams
Browse files Browse the repository at this point in the history
When applications are invoked with execFile the executable
name is passed as an absolute path to the Node runtime,
in order to detect if its an ascii application we need to
strip the path and extract the application name
  • Loading branch information
mmallick-ca committed Feb 1, 2018
1 parent 4735dea commit 6978c6d
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/process_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

#include <string.h>
#include <stdlib.h>
#include <regex>
#ifdef __MVS__
#include <unistd.h> // e2a
#endif
Expand Down Expand Up @@ -65,12 +66,22 @@ class ProcessWrap : public HandleWrap {
AsyncWrap::PROVIDER_PROCESSWRAP) {
}

static bool isAsciiPgm(const char *pgmName) {
const char * AsciiPgms[2] = { "git", "python"};
static bool isAsciiPgm(const char *pgm) {
const char * pgmName = pgm;
const char * AsciiPgms[2] = { "git", "python2"};
std::cmatch cm;
std::regex absolutePath("^.*\/([^/]*)$");
if (std::regex_match(pgmName,cm,absolutePath)) {
pgmName = cm[1].str().c_str();
if (cm.size() > 2) {
return false;
}
}

for (int pgId = 0 ; pgId < 2; pgId++) {
if (strcmp(AsciiPgms[pgId],pgmName) == 0) {
return true;
}
if (strcmp(pgmName,AsciiPgms[pgId]) == 0) {
return true;
}
}
return false;
}
Expand Down

0 comments on commit 6978c6d

Please sign in to comment.