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

Commit 61fbc04

Browse files
committed
[z/OS] Skip character conversion for ASCII streams
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
1 parent 2088cc6 commit 61fbc04

1 file changed

Lines changed: 16 additions & 5 deletions

File tree

src/process_wrap.cc

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include <string.h>
77
#include <stdlib.h>
8+
#include <regex>
89
#ifdef __MVS__
910
#include <unistd.h> // e2a
1011
#endif
@@ -65,12 +66,22 @@ class ProcessWrap : public HandleWrap {
6566
AsyncWrap::PROVIDER_PROCESSWRAP) {
6667
}
6768

68-
static bool isAsciiPgm(const char *pgmName) {
69-
const char * AsciiPgms[2] = { "git", "python"};
69+
static bool isAsciiPgm(const char *pgm) {
70+
const char * pgmName = pgm;
71+
const char * AsciiPgms[2] = { "git", "python2"};
72+
std::cmatch cm;
73+
std::regex absolutePath("^.*\/([^/]*)$");
74+
if (std::regex_match(pgmName,cm,absolutePath)) {
75+
pgmName = cm[1].str().c_str();
76+
if (cm.size() > 2) {
77+
return false;
78+
}
79+
}
80+
7081
for (int pgId = 0 ; pgId < 2; pgId++) {
71-
if (strcmp(AsciiPgms[pgId],pgmName) == 0) {
72-
return true;
73-
}
82+
if (strcmp(pgmName,AsciiPgms[pgId]) == 0) {
83+
return true;
84+
}
7485
}
7586
return false;
7687
}

0 commit comments

Comments
 (0)